Definitely need to know more details.
Some cars have had problems with their Idle Air Control Valves. They use a stepper motor to open a valve to let more air in when the car's idling. But Subarus, and some VW's and Hondas I think, have had problems where the IACV get's gunked up, and needs to be cleaned (by spraying a cleaner, or cleaning the IACV itself), or if it's been gunked up for long, the motor's coils burn out, and the whole unit needs to be replaced.
Or it could be something completely different... knowing which car will definitely help identify any common issues.
(BTW- I think I may just be repeating Orphan's comment above...

)