The z axis bonds are distorted (elongated) in an octahedral complex in some situations because of the Jahn -Teller effect.
The ligand field splits energies of 3d orbitals to three t2g and two eg orbitals. For certain electron configurations like d9 you get
t2g6 and eg3. The three electrons in the eg can can occupy it in two ways with identical energies. This degeneracy will be removed according to the Jahn-Teller theorem by stabilizing one eg orbital and destabilizing the other. This causes a tetragonal distortion.