In bi-propellant engines, normally by making sure that full mixing only occurs inside the chamber, using separate injectors for fuel and oxidizer. If doing early combustion to power turbines you only allow enough to mix to produce the needed energy to power the pumps.
With monopropellants it is trickier, since by definition the mix in the tank could react under the right circumstances so combustion or flashback is indeed a problem. When at full power problems can be avoided by keeping the flow rate above the rate at which combustion can progress upstream in the propellant. Starting and stopping however can be tricky, and devices like flame arresters can be used to avoid combustion running up the plumbing by cooling the flow and reducing pressure.
For more reactive (eg useful) monopropellants the composition of the flame arrester can become substantial and restrictive to flow. J Clark in the book Ignition records decisions not to further investigate otherwise promising materials that could propagate back through 1mm syringe tubing, as building a functional engine would have been impractical. He also records an event where flame traps failed to work for various reasons allowing entire tank contents to detonate on the test stand.
So not generally a problem with most large rockets, but one of several engineering challenge for monopropellants like those used in RCS systems.