The age of your system may determine whether it’s better to repair or replace. On average, hot water heaters last 10-15 years. If you’re in the last few years of that lifespan, then replacement is typically going to be more cost efficient in the long run.
Modern units have better efficiency and will save you money on running costs. You may also be able to upgrade from a storage tank to a more efficient instant hot water unit, or swap from electricity to gas or solar.
If the hot water heater is a newer model, then your plumber can probably repair it. You won’t need to consider replacement unless it’s a serious problem.