ICE is generally used after acute (newer, sudden) injuries with the thought that it reduces inflammation and swelling as well as pain. It is known to decrease blood flow through vessel constriction. Using ice prior to physical activity is not commonly recommended.
Examples of injuries that generally respond well to ice include ankle sprains, knee sprains, new muscle strains, and general injuries that involve redness, increased warmth, and swelling.
HEAT is thought to be best used for more chronic (older, long-term) and recurring injuries and/or pain. It can promote increased blood flow through vessel dilation which can have a relaxing effect. Using heat prior to physical activity is sometimes recommended to promote increased flexibility.
Examples of conditions that respond well to heat include long-term muscle pain and/or soreness, arthritis, and other “stiff” joints.
Physiologically, the effects of heat and ice use are clear in regards to blood flow changes, however, research is not clear whether or not repetitive use is beneficial in injury and pain recovery.
Take the study, The use of ice in the treatment of acute, soft tissue injury: a systematic review of randomized controlled trials from 2004, for example. This study looked at the use of ice after ankle sprains and surgery. It found that there is marginal evidence that ice with the use of exercise can promote positive benefits with recovery. There was little evidence that ice in addition to compression made any changes. There were no recommendations found for time or frequency of icing. 
There is minimal to no clear evidence in regards to whether or not the use of heat significantly changes outcomes of pain and injury.
Because of the lack of solid evidence, the use of heat and ice during physical therapy treatments has decreased. They are considered passive modalities (non-active ways of treating pain) and in general, they can be applied at home. Therefore, spending time in physical therapy icing and heating is now not emphasized quite as much as it was 10-20, maybe even 5, years ago.
This isn’t to say you can’t or shouldn’t use ice or heat yourself for pain or injury because of the lack of evidence for long-term outcomes. It is okay to “calm the system” through the use of ice and heat when appropriate for the conditions mentioned above. Be careful with your reliance on it, though. The use of only ice and heat without exercise or stretching has no evidence. You must pair it with other treatments for optimal recovery. That is a well known fact.
If you have any questions regarding a specific injury or condition and the use of ice or heat, feel free to contact me via email. If you are unsure what type of activities you should pair ice or heat with, physical therapy could be beneficial for your condition.
 Bleakley, C., S. McDonough, and D. MacAuley. "The Use of Ice in the Treatment of Acute Soft-tissue Injury: A Systematic Review of Randomized Controlled Trials." PubMed Health. U.S. National Library of Medicine, n.d. Web. 27 Sept. 2016.