I assume you mean the perpendicular distance?

A rough diagram will help to visualise the following situation.

Let P(a, b) be the point on the line such that the distance between P and (5, 7) is 2sqrt{5}. Then:

(a - 5)^2 + (b - 7)^2 = 20 .... (1)

The lines obviously have the form y + 3 = m(x + 5).

Also (a, b) is on the line and so:

b + 3 = m(a + 5) .... (2)

The line segment joining P and (5, 7) is perpendicular to the line and so:

(b - 7)/(a - 5) = -1/m .... (3)

Solve simultaneously to get the value of m.

I get m = 2 (for P(1,9)) or m = 1/2 (for P(7,3)) but I sometimes slip up .......

Off-hand, I don't see a more elegant way.