Inconsistent water heater temperature
If this is an ordinary glass lined steel gas fired water heater it is likely at the end of its reliable service life. Get a new tank installed.

If you want to try a simple fix you could cycle the temperature setting knob by twisting the temperature set knob on the gas valve down to the lowest temperature, then up to the highest temperature and see if the burner comes on. Then turn the temperature knob down to the "recommended" setting--there will be a mark. Maybe you could set the temperature a little above this and it would work.    

There is a temperature sensor probe which protrudes into the tank behind the gas valve and senses the temperature of the water inside. The burner turns on and off according to the state of this sensor. If this is malfunctioning, it could lead to the burner failing to come on sometimes or shutting off prematurely before the water has reached the set point. I think this is part of the gas valve assembly and not separately repairable or replaceable. The entire gas valve assembly is probably replaced as a unit.

This is not a job for the ordinary DIYer. You could call a plumber to do this repair, but almost certainly the water heater should be replaced.

The anode rod has nothing to do with this. Anode rods are well known to get stuck in place if they have been in service for this length of time.