Idiomatic use of 距 and 離
距, 离 and 距离, these three can be replaced with each other and would Not change the meaning.
But 距 is slightly more formal, but only slightly. In speaking, 离 and 距离 is used more commonly.

However, they are used when expressing distances, doesn’t matter whether vertical or horizontal, you can use either of these three words