Help with sudden z movement

I was running a project and it was on the last letter when it suddenly plunged through the project. I am a newbie and it’s first time I encountered this bizarre result. Is there something I need to do to prevent it in the future?
Thank you

You are not alone. It has happened to me a few times but don’t know what exactly caused it. I even ran the same code afterward with no problems