I assume you already found the Wikipage https://en.wikipedia.org/wiki/Distance_from_a_point_to_a_line

Depending on your programming environment there might be already functions to do the calculation but I didn’t find any hint aboute that searching Google.