Line Trace from a 3d point to mouse location

I’m making a 3d side-scroller game and I want to do a line trace from the character glasses to wherever I click on the screen with the mouse.

I want this trace to stay on the same plane as my character, so the X value of the start point & end point should be the same.

This is the best I could do, but it’s not accurate - When I click roughly in the center of the screen the trace is pretty accurate, but when I click further away from the center it gets less and less accurate…So…What am I doing wrong ?