If fuel injected, check the IAC valve. This valve allows a small amount of additional air (or less) into the engine to stabilize the idle. Normally it is located on the throttle body, it could be sticking. Check this first. And check the MAP sensor. You can try cleaning these with Seafoam or something similar. Might be a fuel system problem, fuel pressure, etc.