If you've got a storage type water heater they have a sacrificial anode inside to reduce corrosion of the actual heater tank. They're meant to be replaced at intervals (around five years typically) to make the heater last longer.
I changed mine today and it was showing very noticeable wear, I doubt anyone had changed it since the heater was put in around ten years ago (in part because it's installed in an awkward position under the sink so you have to remove the sink to change the anode).
Comparison photos between the old and new anodes:


Technically you should probably get a plumber to do this but it's easily done if you've got a decent sized socket set and are cluey enough to realise you should turn the inlet tap off and have a pull at the pressure release valve before you open the tank.
Solarhart send me reminders every 5 years to replace anode in my solar hot water. It is surprising how much it degrades over 5 years.