A gas heater has a flame, a gas valve, a thermocouple or igniter that proves the flame, and a flue that carries exhaust away. Most gas failures are one of those four.
The common failures
Pilot will not stay lit. The flame lights, you release the knob, and it goes out. That is the signature of a thermocouple that is no longer generating enough current to hold the valve open, or of a dirty pilot orifice. It is a repair, not a replacement.
Pilot will not light at all. Gas supply, a blocked orifice or a failed valve. This is where the gas utility matters: if other gas appliances are also out, it is the supply and belongs with them first.
Yellow or lazy flame. A gas flame should be blue. Yellow, lifting, or sooty burning points at air supply or a venting problem, which is a safety issue rather than a performance one — and it needs attention before the heater is used again.
Rumbling and popping. Sediment on the tank floor under the burner. Flushing is the job.
Water at the base. The tank, not the gas train. That is the replacement conversation.
Safety, plainly
If you smell gas, leave the space and call the gas utility before anything else, then deal with the heater. Do not relight a unit that has been flooded or has a yellow flame and keep using it — a venting fault puts exhaust into the space.
What is repairable
Thermocouples, igniters, gas valves, pilot assemblies, dip tubes, relief valves and drain valves are replaceable. A rusted-out tank is not. If the flame behaviour is fine and the water is the problem, the gas side is a red herring. Where the flame is the question, why a water heater stopped heating sets out what each pilot behaviour points at.