the distance between these 2 points (= length of the line segment) is calculated via Pythagoras for right-angled triangles.
c² = a² + b²
c is the Hypotenuse and the distance between the 2 points. a and b are the legs of the triangle enclosing the 90 degree angle, as they are the differences between the x and the y coordinates of the points.