When a material is heated or cooled, two changes may happen to the particles within the material:
When energy is given to raise the temperature, particles speed up and gain energy.
The conservation of energy means that, assuming no energy is lost to the environment, any energy transferred to a material will be distributed between the chemical store and the thermal store of the internal energy.
When the substance melts or boils, energy is put in to breaking the bonds that are holding particles together, which increases the energy in the system. Throughout all of these changes the total number of particles, or mass, does not change.
The bonds between particles in one substance may have a different strength to the bonds between particles in another substance. If these bonds are stronger, more internal energy will be needed to break them and so the temperature for melting or boiling will be higher.