Energy can change state
During melting or boiling of a pure substance at constant pressure, energy is transferred in while temperature stays constant. Energy changes the particles’ potential energy.
Particles do not simply get hotter during the flat part of a heating graph.