Explanation:
the other answer is correct.
just a few words about the why :
when you look at 2 points on the coordinate grid, then the distance between them creates a right-angled triangle.
the direct distance is the Hypotenuse (the baseline opposite of the 90° angle).
and the x-coordinate difference and the y-coordinate difference are the legs of that triangle.
and then we can use Pythagoras
c² = a² + b²
c = sqrt(a² + b²)
with c being the Hypotenuse.
and you see, that is exactly the so-called distance formula the other answer used.