2008 Subaru Impreza - Fob trouble

Key fob not working.Started with it occasionally not working now it doesnt work at all. Car acts like the key is still in the ignition(dinging when door is opened)also doesnt turn off headlights when key is out of keyway. Have replaced fob batteries,no change

Does it do this with BOTH fobs? If so, it might be a failure of the fob’s receiver radio in the car. If only on fob does this, it is likely a failed fob.

bought the car used,only have one fob and one key.I guess it could be the fob,would that also cause the ignition to think theres a key in it when it’s not? Also the head lights used to go off when the key was removed,they are staying on now

The switch in the ignition lock cylinder that detects if a key is inserted is stuck.

is there a way to un-stick it,or am I looking at a new ignition?