Won't idle (stalls)

2000 nissan maxima will start and idle fine when first started in the morning. When engine warms up it drives, but won’t remain idling (stalls) when put in “park” or “neutral”. Yet when left in “drive”, it will idle fine.

Usually they stall in “drive” and idle better in “park” and “neutral”