Hey when the car idles it revs up and down by like 300 revs or so and also when the car is off it doesn’t recognize its in park.

When I switch off the car (it's push to start) the car doesn't recognize its in park so when I get out the car keeps beeping and I have to disconnect the battery to stop it , what do you think could be the cause of this also with the transmission revving up while idling?

My car has 155000 miles.
My car has an automatic transmission.

– Hey when the car idles it revs up and down by like 300 revs or so and also when the car is off it doesn’t recognize its in park.