Project position onto direction

Maybe this will help with explaining what I want to get from this function:

The blue circle is the player, the black lines are the vectors coming from it, with the vertical one representing the forward vector, and the black circle is the actor I want to check.

I want to get the length of the grey vector shown