2002 Gear shifter won’t disengage out of park

Has anyone had this happen? Sometimes it takes several times stepping on the brake pedal to get the gear selector to move. I’m afraid to drive the car now as it may strand me somewhere. I’m hoping it might be the switch on the brake pedal instead of the part connected to the ignition switch. Can anyone help? Thanks, JT