On a gas hot water heater, it is now a CA code requirement to have a sediment trap in place when a new water heater is installed. As you can see in this image, the sediment trap has been installed but it was installed incorrectly and is facing the wrong direction.
As the gas comes in, if it has any sediment in it it needs to have an area for the sediment to drop in order for the gas to enter the unit. If it does not, the sediment can enter the unit and can block areas are required to be free like the gas jets, which can cause the hot water heater to not work correctly.
If your hot water heater either does not have a sediment trap or it is incorrectly installed, I recommend having it inspected by a licensed certified plumber