(N/A) The reason for both phenomena is the $Second$ $Law$ of $Thermodynamics$,which states that heat naturally flows from a body at a higher temperature to a body at a lower temperature until thermal equilibrium is reached.
$1$. In the case of the cup of ice water,the surrounding air (at a higher temperature) transfers heat to the ice water (at a lower temperature),causing the ice water to heat up.
$2$. In the case of the cup of hot tea,the tea (at a higher temperature) transfers heat to the surrounding air (at a lower temperature),causing the tea to cool down.
In both scenarios,the system and the surroundings are moving toward thermal equilibrium with the ambient temperature.