I'm not exactly sure about your notation. I assume that you have a curve parametrized by , and a point with position vector . If so, why don't you just consider the square of the euclidian distance of and , that is

Its first derivative is

Obviously, the condition that this derivative be equal to 0 is equivalent to your condition that the vector be perpendicular to the tangent vector .

To distinguish between points of shortest (local) distance to from those of greatest (local) distance, you can now check the sign of the second derivative of