The majority of earth's water is in the oceans. Water molecules are in motion in all three states and the speed of the moving molecules determines the state of water for a given location. Hydrogen bond forms between water molecules Covalent atomic bonds between hydrogen and oxygen atoms create a characteristic bipolar atomic structure that has a negative charge adjacent to the oxygen atom and positive charge between the hydrogen atoms. In solid form the molecules join together in a well-ordered hexagonal structure. Groups of molecules remain attached in the liquid phase of water but have sufficiently rapid motion to generate less ordered structures.
Water molecules move too rapidly in the gas phase to allow bonding between molecules.
The organization of atoms becomes more structured passing form gas to liquid, to solid. Heat energy is released or absorbed as water changes state. We can measure the loss or gain of sensible heat by measuring temperature changes. However, if the pan initially contained a mixture of water and ice, the temperature would not increase until the ice had melted. Heat is absorbed by the water during the change from ice to water but there would be no corresponding change in temperature until all the ice has melted.