If you are trying to keep the milk for multiple days in the fridge
It will become unsafe after 3-5 days, there is no way around that. If you switch to UHT milk, it will still be unsafe 3-5 days after opening the container, but it won't taste bad, so ...
What does this mean for the milk and the decision of whether to discard it?
(Traditionally I would discard milk if it tastes off to me.)
Specifically, a trajectory explanation of which microorganisms are killed of in the milk via UHT, so that it might not go "bad" taste wise, would be helpful.