Distance between points on specified axis?

Edit: Whoops! Thought this was in the C++ section.

Assuming you have:

FVector Arrow;
FVector RedDotPosition;
FVector GreenDotPosition;

//The key is to normalize the arrow vector, so it doesn't scale your distances.
Arrow.Normalize();
float RedDistanceAlongArrow = FVector::DotProduct(Arrow, RedDotPosition);
float GreenDistanceAlongArrow = FVector::DotProduct(Arrow, GreenDotPosition);
float Distance = GreenDistanceAlongArrow - RedDistanceAlongArrow;

If you want displacement, then multiply it by your normalized Arrow FVector.