What is the distance between #(4,2,2)# and #(5,-3,-1)#?
Imagine a strong light directly above the line such that the z-axis is vertical and the xy-plane is horizontal. The line would cast a shadow onto the xy-plane (Projected image) and it would in all likelihood form a triangle with the x and y axis.
You could use Pythagoras to determine the length of this projection. You could again use Pythagoras to find the true length but this time the z-axis being as if it is the opposite and the projection being the adjacent.
By going through this process you will find that the final equation boils down to:
Let the distance between the points be d