You may find your water heater's thermocouple is to blame for your water heater pilot light not igniting or the water heater burner not staying lit. The thermocouple is actually very easy to fix so don't be reluctant to do it yourself.
As with a thermocouple in a gas furnace, you'll find gas water heaters use a thermocouple to control gas flow in older style standing pilot models. Similarly, newer electronic ignition pilot models use a device called a Piezo Igniter like the one shown in this blog photo. The thermocouple is part of or attached to a pilot burner assembly and will connect to the gas control valve on the outside of the water heater.
In the tutorial Replacing a Water Heater Thermocouple or Flame Sensor I'll provide illustrated step-by-step instructions on how to remove and replace your water heater's thermocouple so you can keep yourself in hot water!