Greg has some good points, about the fact that the air expands as you go up, so sometimes when you start ascending (Going up), It creates a chain reaction where you keep rising.
I’m in experience rescue diver and this doesn’t happen to me often, but occasionally if I get distracted and start rising, what I do is I immediately do 2 things:
1) I grab my deflate valve, hold it high and deflate myself until I stop rising and start descending
2) immediately after I’ve gotten a hold of my deflate valve and started letting air out, I immediately grab my dive computer/watch (I just hold my right hand to my face and read it, as it’s on my wrist) and I carefully monitor my depth.
If I start descending, then I will kick and let a little air back in as I kick to maintain depth. I also will use air in my lungs to help maintain depth until I stabilize. An almost full breath helps you rise... empty lungs helps you descend (go lower).
WHAT NOBODY IS MENTIONING IS THAT THIS SIMPLY TAKES PRACTICE TO GET GOOD AT. It also takes mental memory... so doing it a few times on many different days will help you master it.
Ideally, you also want to focus on making sure your WEIGHTING is correct so that when you deflate your BCD, you are just barely neutrally buoyant on the surface (at eye level or forehead level with a full breath). Then you can blow your air out of lungs, pull yourself down with your arms, and bam; you’re neutrally buoyant right off the bat. To get this perfected you need to figure out your right amount of weight. This can change if you’ve gotten fatter or skinnier since your last dive, or if you’re wearing a different wetsuit.
You also need to focus on staying very calm- like a surgeon, almost. Think clinically and logically, be calm but think quickly. Do not ever panic. If you think intelligently and calmly, focus on what you’re doing and always think 2 steps ahead too, then you’ll be fine.