Put two points on graph paper, A(2,1) and B(8,9). Walk from A to B along the grid lines: 6 units right, then 8 units up. Those two moves are the legs of a right triangle, and the straight segment AB is its hypotenuse. The Pythagorean theorem gives AB2=62+82=100, so AB=10. The distance formula is that triangle written with coordinates: the legs are x2−x1 and y2−y1.
Signs take care of themselves. Going from (8,9) back to (2,1) gives gaps of −6 and −8, but (−6)2=36 and (−8)2=64, the same squares as before, so the distance is still 10. Order does not matter, as long as you subtract x from x and y from y. Two points on the same horizontal line have a y-gap of 0, and the formula reduces to the difference of their x-values.
The walk along the grid, 6+8=14, is a different measure, sometimes called taxicab distance, and it is never shorter than the straight line. The midpoint uses the same two points but averages them to find a location, (5,5), not a length. Slope compares the same gaps by dividing, 68=34, to describe steepness. Decide whether the question wants how far, where, or how steep.
Think of it like this. The distance formula is how a crow flies across a city laid out in square blocks. A taxi must drive 3 blocks east and 4 north, 7 blocks in all; the crow flies the hypotenuse, 5 blocks. Real cities have uneven blocks and hills, but on the coordinate grid the crow's path is exact.
Core idea. The straight-line distance between two points is the hypotenuse of the right triangle made by their coordinate differences.