Before a control is condemned, two local conditions deserve a look: the temperature of the water coming in, and how the house is used.
Cold inlet, big demand
In January the incoming water is near freezing. Raising it to a usable temperature takes far longer than in summer, and the pipe run loses heat on the way. A tank that copes in July can look broken in February with nothing wrong with the control.
Add weekend occupancy and the pattern sharpens: the tank sits cold, then the whole house wants hot water at once.
Proving it
Electric. Meter the thermostat through a full cycle, check that the upper control hands over to the lower, and test the elements at the same time — because an element fault produces the same symptom.
Gas. Verify inlet pressure, pilot proving and the valve's response to a call for heat.
Only after those tests does a replacement make sense.
Settings that suit the house
Hot enough for the household, no hotter. On a seasonal property, a modest set point plus a mixing valve at the outlets gives more usable hot water without raising scald risk.
Sediment and iron
The valley's water carries iron — averaging about 15 ppb, occasionally much higher — and that settles in the tank. It is less likely to foul a thermostat well than heavy calcium scale would be, but clearing sediment while the unit is open is still worth doing.
What to have ready
What you are seeing, whether it is too hot or too cold, the fuel type, the tank's age and how the house is occupied. Those five answers decide whether this is a control, an element or demand.