shattered sanity,
I see two things here with one answer. One, you are experiencing a symptom of DID (feel like you are standing outside of yourself watching yourself do things) or two you are experiencing astral projection. I don’t believe there is a ’cure’ as such but grounding yourself may help. You can ground yourself by having something around you to focus on or to read aloud when you feel this out of body experience coming on. It’ll take a bit of practise but it does work - most of the time.