How to optimize the calculation from point to line?
Clear["Global`*"]
line = a x + b y + c == 0
pt = {x0, y0}
pol = Apply[Subtract, line]
Flatten@CoefficientList[pol, {x, y}]
A1 = Coefficient[Apply[Subtract, line], x]
B1 = Coefficient[Apply[Subtract, line], y]
C1 = Select[Apply[Subtract, line], FreeQ[x | y]]
distance = Abs[A1 pt[[1]] + B1 pt[[2]] + C1]/Sqrt[A1^2 + B1^2]