Your choices here are about the balance of risk you're willing to take of an upset tummy, versus a screaming infant waiting for milk.
Formula powder is not sterile, but if stored dry under ambient conditions its hardly a hive of bacterial growth. (If its warm and damp it could be, though!)
Once the powder is hydrated, the bacteria in it will multiply, and could reach levels that are able to cause upset tummies.
If you make up the formula with hot /boiling water then that'll kill most of the bacteria in the powder at the time you make it up. (It also denatures quite a lot of the vitamins, which is why formula manufacturers give different guidance to the world health organisation on how to make up formula). If you then stick that "made with boiling water" formula in the fridge, it'll rapidly get too cold for the remaining bacteria to grow at any rate. It's then probably safe a baby to drink it a few hours later.
If you make up formula powder into warm water and it was stored dry, with low levels of bacteria, and feed it to a baby immediately then there probably isn't time for the bacteria to multiply to a point that is dangerous.
So, safest is to make up fresh with water hot enough to kill bacteria and cool to feeding temperature and feed immediately.
Next safe is to make up with hot water and store in fridge.
Least safe is to make up with warm water and feed immediately.
But most of the time all of them will be fine. What you need to avoid is starting with lots of bacteria present, giving it lots of warmth and water, and then giving loads of time for it to multiply. As an manufacturing engineer who used to work in food doing calculations on how long we could leave things warm and wet before the bacteria levels could be harmful, I did all 3!