As a substance approaches its melting/boiling point the energy is no longer transferred to the kinetic energy store so the temperature remains constant. However the energy is now transferred to the potential energy store which is used to break/make the intermolecular forces of attraction.