One simple test to carry out is to check if it returns to the expected Z height at the end of the job. If you've been losing steps along the way, these will most likely accumulate and if you then ask the machine to go to a known Z height at the end of the job, that will be different to what it was when the job started. You could measure Z0 with a test indicator, rehome and then remeasure Z0 perhaps. Both should happen at the same height.

I found this on my Bridgeport conversion. In my case it was due to noise pickup on the wiring which I was able to fix by clipping loads of those ferrite clamp things on the cables. This was during commissioning of my new system. If yours worked fine for ages then started to misbehave, something has changed which could be a different problem. On the other hand, it may have been very marginal all along and something has changed or moved just enough to make it misbehave, such as a cable relaxing or a cable tie failing.