This the difference between a good driver and a poor driver. A good driver must anticipate what may happen ahead of them and act before there is a problem.
A poor driver reacts to the problem, and to often will become part of it.
Sometimes acting can be as simple as taking your foot off the accelerator, gas pedal, as you approach a potential problem. You may even slide your foot over the brake pedal ready to brake if need be. If nothing happens then you can drive on. If something does happen you are ready for it.
Act, don’t react.