Did you look up the codes?
There is no p017
I will assume p0171, and with p0172 these mean one bank of the V6 was running too lean and too rich at some point.
So most likely symptom not the problem, but O2 sensor on that side could be suspect.
p1506 points at the IAC, idle air control
This is a valve on the intake that opens and closes to let more or less air into the system, it is operated by the engine computer(PCM or ECM) based on the readings from other sensors.
These can be tested and cleaned.
p0402 points at the EGR, exhaust gas recirculation, this is also a valve that opens and closes to let exhaust gas into the intake to reduce pollution.
These can be tested and cleaned.
None of this means the IAC or EGR is at fault, it could be something as simple as a cracked or unplugged vacuum line somewhere, allowing too much unregulated air into the system and the sensors are trying to compensate for it.
A clogged PCV could even be the problem, easy to clean and test.
One thing to remember about sensors and the ECM(engine computer), the ECM has a memory and simply swapping out sensors often doesn't work because of the ECMs memory.
If you do work on a sensor, i.e. clean it or replace it, disconnect the negative battery terminal for 10 minutes, like while you are working on the sensor.
When you connect the ECM back to power it will reconnect to all the sensors and relearn their engine off settings, so the cleaned or new sensor's settings are being used not the old settings.