Sounds like a switch. There are several kinds: the most common is the float that is attached to a cord. It can malfunction if it gets covered with something. Some floats are attached to the pump and some are attached to the standpipe.
There is also an older type that is still around that has two rubber weights and is counterbalanced by a spring. This unit attaches to the lid and the weights hang down below.
The third type that I'm aware of is the pressure-activated switch. This is part of the pump and would probably require the replacement of the pump.
There's also a mechanical type float that is hooked to the switch in the pump and again, the pump should be replaced.
Sometimes, you can look into the sump and see that there is debris on the float causing it to fail. Sometimes, it's because of the poor placement of the float directly in line with the incoming sewage.
Sometimes, the float switch fails because of age - the metal parts get arcing inside the switch - a metal part sliding onto a contact.
In the spring-loaded type, the spring gets weak or the floats accumulate debris.