The sensor used to detect whether the pilot light is on is called a thermocouple. The thermocouple senses heat from flames while the pilot light is on, and it transmits the right voltage to the gas valve to keep it open and prepared to ignite the burners.
Even when the pilot light is on, a malfunctioning thermocouple has the ability to cut off the furnace’s gas supply. In the event that your pilot light goes out, the gas valve will shut to stop gas leaks into your house or, in the worst case scenario, flood the combustion chamber and ignite a spark that might explode.
To determine whether the thermocouple is failing, one should search for signs such as discoloration, cracks, pinholes, or corroding wiring.