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 they gain kinetic energy.
When the substance melts or boils, energy is put in to breaking the bonds that are holding particles together, which increases the potential energy.
The conservation of energy means that, assuming no energy is transferred to the environment, any energy transferred to a material will be distributed between the chemical store and the thermal store of the internal energy.
Whether the energy breaks bonds, increases the speed of the particles to stretch bonds, or just increases the speed of the particles depends on the temperature and state of the material.