Intermittent Idle surge/cycling

automatic transmission.
As the title says Im experiencing intermittent idle surging but it only happens after the engine is warmed up and only when the car is in park.Idle will creep up and peak at 1,500 rpm and then go back down to 700 rpm,it takes about 15-20 seconds for a complete cycle (from 700 rpm up to 1,500 rpm and back down to 700 rpm) It doesnt always do it when the engine is warm but when it does do it it usually lasts for several minutes.
never does it when the engine is cold.
never does it in neutral or any other gear,only in park.
I dont know if this is related but Ive also noticed that that the transmission wont shift from reverse into neutral but it will shift from drive into neutral.If I shift from reverse into neutral the car thinks its still in reverse and continues going back.(car has a floor mounted shifter between the front seats)

I thought it might be the idle air control valve but wouldn`t the idle continue to cycle,like that, even if the car is in gear?

In addition to the IAC, I would suspect a possible vacuum leak–if the car has accumulated a lot of miles on the odometer. If you would reveal the make, model, model year, and odometer mileage of your vehicle, perhaps we can be more specific.

Its a 1993 nissan maxima SE 3.0 liter DOHC, 226,000 miles. I did recently replace the intake plenum gasket and some vacuum lines.I dont have a torque wrench so I didnt torque the intake bolts. as far as the vacuum lines, I took a guess at what size lines to buy so I know some of them arent the same size as the original ones.some are smaller, some are bigger.

“never does it in neutral or any other gear,only in park.”

This is a major head-scratcher to me. Could you double-confirm that this is true all the time?

“I dont have a torque wrench so I didnt torque the intake bolts.”

If those bolts are not properly torqued, that could well be the source of a vacuum leak.
Harbor Freight has reasonably-priced, decent-quality torque wrenches that are fine for the person who uses the tool only occasionally. Those tools wouldn’t be a good idea for a professional mechanic, but for the DIY-er, they are fine.

…and what can you tell us about the maintenance record for that transmission?
At that age and that number of odometer miles, the trans fluid (and filter) should have been changed about 7 times.

Ill double check that. When it was in park and started doing that, I shifted to drive and it immediately stopped cycling and smoothed out at about 800 rpm.When I shifted it to neutral it stayed smooth, when I shifted back to park it immediately started cycling again. Thats why I mentioned the problem with going from reverse to neutral, I thought maybe it has something to do with vacuum from the transaxle? I saw a few vacuum lines connected to the transaxle,maybe I should check them for leaks?
I also saw a “vent” hose on the transaxle, I think its a vent because the one end isnt connected to anything.I checked online and sure enough it`s not supposed to be connected to anything.

ok, Ill get my hands on a torque wrench and check the manifold bolts. The transmission? well lets see, my daughter bought the car about 4 years ago from an auto auction, Im not %100 sure if she ever had the transmission filter or fluid changed, but she might have.The reason I think that she might have is because she used to regularly take the car to one of those lube places for oil changes so they might have talked her into getting the transmission done too, I`ll have to ask her about it.

Good comments above. One more idea. Cars of that era often had idle speed adjustment screws. If the idle speed screw is adjusted using that screw for a reason it shouldn’t be – like to compensate for a vacuum leak – idle surging is often the result. The idle speed screw must be within a narrow range, and shouldn’t be used to compensate for other problems affecting idle speed. If your car sports one, return the idle speed screw to its nominal setting and see if that affects the surging symptom.

Make sure all ground straps and connections are clean and tight.
Ground potentials are the only thing I could see changing going park vs neutral.