See the picture below for a way to construct a right triangle that makes that piece the longest side of the triangle your line segment.
With that setup, you can use they Pythagorean Theorem.
[tex]7^2 + 6^2 = c^2[/tex]
And then solve that for c, keeping in mind c must be positive.
[tex]\begin{aligned}49 + 36 &= c^2\\85 &= c^2\\\sqrt{85} &= c\end{aligned}[/tex]
If you want to use the distance formula, that is just the Pythagorean theorem solved for c:
[tex]d = \sqrt{(x_2-x_1)^2+(y_2-y_1)^2}[/tex]
Applying that to your situation
[tex]d = \sqrt{(5-(-2))^2+(-5-1)^2} = \sqrt{(7)^2+(-6)^2} = \sqrt{49+36} = \sqrt{85}[/tex]