It all depends on the type of injury to be treated. For an acute injury, just in the first 48-72 hours after it has occurred, the ideal is to start with cold for about 5 minutes, and then apply heat for the same period of time. In this way, vasoconstriction is achieved first, which will reduce inflammation, to later dilate when the hot water is applied, which will favor the drainage of possible edema that may form in the soft tissues.
In the case of chronic injuries the recommendation is the opposite, and should start with hot water to improve blood circulation in the first minutes of the session, and then apply the cold as a constrictor agent that will generate pain relief. In this case the application times change and start applying the hot compress for a maximum of 3 minutes, and then use the cold compress for no more than 2 minutes, and alternate constantly without a break for 15 or 20 minutes.