When I do a yarn over, I place my right index finger on top of the right needle and hold the yo in place until I anchor it with the next knit or purl stitch. There’s nothing written in stone that says you have to have an even number of stitches on each needle. You can place one or two stitches from the other needle in front of the place where you do the yo to make it easier. You can just place a marker at the spot where the yo begins so you know where you are.
One example is a certain size of mitten that I knit. The cast on is for 28 stitches. I want to do a k2, p2 ribbing, which is a multiple of 4. An even number of stitches on each circular needle would be 14. That’s not a multiple of four. So I put 16 stitches on one needle and 12 on the other. I just even the stitches between the two needles once I get the ribbing done and I begin the stockinette part of the mitten.