If I were you, I will solve it using simple algebra (find two vectors intersection):-
- Form a 2d vector for both (using their normalized directions). 2d vector can be formed by eliminating the ‘z’ component.
- You will find the point where both intersects - then this is easy as you can calculate the magnitude (length) between two points.