I hope this is stating the obvious, but if somehow your car keeps accelerating even after you take your foot off the gas pedal, like the recent crash in California that killed four, keep calm and PUT THE CAR IN NEUTRAL and coast until you can safely pull over.
The engine is what powers your vehicle. The transmission is what transmits that power to the wheels. Putting the car in neutral disconnects the engine from the wheels.
Why the off-duty police officer in California did not realize this in time, I do not know. But the solution, whether automatic transmission or standard (stick) is to PUT THE CAR IN NEUTRAL.
This is safer than turning the ignition off.
Do NOT try to put the car into PARK or REVERSE while going forward unless you are intending on buying a new transmission. Put the gear into NEUTRAL (N), which is next to DRIVE for this very reason.