Given an finite line segment $\overline{AB}$, and a set of points $P$ lying some distance away on one side of the line, what would be the general way to check, for any given point $P_i$, whether it is closer to any part of the line than any other point in $P$?
For the case where $P_i$ is outside the endpoints of the line, it's as simple as checking whether $\exists Pj\, d(Pj,A)<d(Pi,A) \cap d(Pj,B)<d(Pi,B)$ where $d$ is a distance function. However, when the point is between the endpoints of the line, it seems more complex - the nearest point on the line to $P_i$ could be closer to $P_j$, but some other point on $\overline{AB}$ might still be closer to $P_i$.
The question suggests to me that this query might be made repeatedly, either on the given line or on a succession of lines. If this is also associated with a fixed population of points over a reasonable number of queries, it might be worth creating the Voronoi diagram for those points, which describes the nearest neighbourhood for each point.
Then any point on the line segment - including the end points - would fall within one of the described cells that represent the portion of the plane that is closer to that point than any other. The portion of the line that is closer to a given point than any other would be exactly that part of the line segment that is crosses the corresponding cell in the diagram.
Example Voronoi diagram from Wikipedia:
