If the resolution of the way-points is distinct enough I can see two cases: The nearest way-point is either the next point or was the previous point:
So if you not only calculate the distance to the nearest point but also to the previous and next to it, you should be able to simply decide which one the next is.
As written, this requires that the resolution between the points is good enough. E.g. if you have a course with a 180 degree curve things don't evaluate that well any longer:
The solution is to have enough way-points in these areas then. So this might or might not be suitable for your problem. Sorry for the trashy graphics, but I hope they illustrate this well enough. Also the concept is a bit rough, but probably good enough to create a first mock.