Almost every driving emergency has one instinctive response that makes it worse and one trained response that fixes it. Pick the situation. You get the correct order of actions, the specific thing your body will want to do that you must not do, and how deep the water has to be before you stop.
Around 15 cm of fast-moving water is enough to sweep the wheels out from under a car and you lose steering. Around 30 cm — about knee height — is enough to float most cars off the road. Around 60 cm will float a large 4x4. None of those numbers require a dramatic flood; they are the depth of a normal flooded underpass.
The other problem is that you cannot see the road. The surface may have been washed away entirely, a missing manhole cover is invisible, and the kerb you are steering by is underwater. If the water is moving at all, or you cannot see the far side clearly, the answer is to turn around. Most vehicles swept away in floods were driven in deliberately.
If you do get caught: modern cars seal reasonably well for a short while, which is why you should not try to open the door against the pressure. Undo the belt, open or break a window, and get out through it while the car is still floating. Once it fills, the door will open, but by then you are working underwater in the dark.