I think it usually happens when you're in a stressful place or situation, and zoning out kind of thing is kind of like going to a quiet place for a moment. And it's not all bad either, and I don't know how to stop it really but if your mental battery is low and it keeps happening maybe it's a sign to recharge or something? Like if possible just go to a safe place or if your talking to someone who might be stressing you out, don't for a while. I don't really know what's going on or even what i'm talking about but hopefully you can get the support you need or want, stay safe out there!
Oof just stumbled upon another thread and inside are some tips for dissociation if you want to check it out. https://www.7cups.com/forum/AnxietySupport_53/AnxietySupportShareYourStoryHowdoyoufeelrightnow_667/Anxietyandpanicfeelslikeimpendingdoo_295143/