If the registers counting encoder pulses say an axis has hit the right destination, the readout will simply reflect the "right" coordinate. As far as the control is concerned, there is nothing to correct. If there is a flaw with the encoder (dirt, breakage, or even a glass encoder wheel separating from its aluminum hub), the control will still drive until either an e-stop hits or the axis pops a breaker (the mechanical stops either work or they don't).
The connection to the encoder is suspect. I have also seen the set screws on the coupling work loose. Then, if there is a flat on the encoder shaft, I have seen the coupling wobble back and forth because of the play as the set screw catches on either side of the flat.
I have also seen where the bearings begin to fail in an encoder. This is unusal because the encoder isn't supposed to see any torque to speak of. Sometimes it does, especially when a coupler is installed improperly. When the bearings are good in the encoder, there is so little encoder induced drag that the coupler easily turns the encoder, even when the set screws are not tight. When the bearings are bad, and the coupler slips for any reason, trouble.
So - How is the encoder attached to the Z drive? Is it on the end of the motor housing (and thus often part of the back end shaft)? If so, look to the motor as having the highest odds of being the problem. Otherwise, the encoder is usually the easiest thing to investigate.
Some systems will drive a leadscrew through a belt and have the encoder attached to the leadscrew instead of the motor. These types of systems will then have a coupler going to the leadscrew that attaches the encoder.