1. Keep your foot firmly on the brake pedal. This is crucial to prevent the car from rolling.
2. Shift the car into Park (P).
3. Turn the car back on.
That's it. Modern cars have safety features that will prevent them from unexpectedly moving in most scenarios, even if the engine is briefly off. However, it's best practice to always put the car in Park before turning it off.