There are hundreds of DTC codes and each has a story to tell. Go to your local autoparts store and have the codes pulled. Post the full codes to end guessing games.
But for starters (like everyone of these kind of problems), clean the MAF. Use only a product designed for the job. No brake clean. No carb/choke cleaner.
Check for vacuum leaks. Check all hoses, connectors, junctions, PCV valve (replace if old), oil dip sitck, oil filler cap, and gaskets. Even a tiny vacuum leak can cause problems.
For a slow idle, pay special attention for vacuum leaks in the IAC bypass line. A weak ignition or weak/misfiring cylinder can also cause a slow idle. Finally, many idle problems are resolved by replacing the IAC.
Check the battery. Is the top of the battery clean? Are the terminals clean and tight? Clean any corrison. Today's car can not run well without a strong charging system.