I just changed the mass airflow sensor and I am still getting codes P0171 and P0174. I'm thinking it could be the O2 sensors.
The codes you have for your GMC Yukon, p0171 and p0174, are informing you that the engine is running lean. This means that there is unmetered air entering the engine after the mass airflow sensor and is disturbing the air/fuel ratio needed for your Yukon to run properly. Typically when both of these codes are present, it is a strong indication that the intake manifold gaskets have a vacuum leak. Attaching a vacuum gauge to the engine while it is running will quickly tell you how severe the vacuum leak is. In order to pinpoint the source of the vacuum leak, a special smoke machine needs to be hooked up to the engine. Typically, this is done right at the throttle body. Smoke will fill the intake manifold and vacuum hoses and once it finds a leak, smoke will seep out of it and will be visible to see.
I would recommend enlisting the assistance of a certified mechanic to come by and inspect your GMC Yukon. They will have the speciality tools and experience needed to determine exactly why your Yukon is running lean. They will also be able to perform the repairs necessary to eliminate the vacuum leaks and get your GMC running like a champ.