When the substance melts or boils, energy is put in to breaking the bonds that are holding particles together, which increases the potential energy.