This is mainly caused by poor circulation in the hot water line.
First, check whether the water heater inlet valve and hot water outlet valve are fully open. Also inspect the mixer valve and hot water pipes for throttling or limescale blockages. Clean and clear the blockages to restore normal flow.