My 2002 Expedition air conditioner will sometimes blow hot air and others cold air
I would check the following possibilities:
1. Is compressor clutch working? - You need to do this when the ac is blowing hot air only - locate compressor drive pulley on engine - rubber belt wraps around it. Start engine and set to max ac. When the ac is blowing hot air, look at the center of the compressor drive pulley using a good flash light - watch it for a while, it should be spinning with the pulley - this means the compressor is engaged. If not, the compressor is not engaged. If your ac is blowing hot air, then the compressor should be engaged and running (trying to cool). If it is not engaged, then your compressor clutch is probably going out. Could be low voltage to clutch, but more likely the clutch is worn out and only working some of the time. Note: if working normally, the compressor clutch will engage and disengage in cycles- but the air should always be cold. If clutch is bad, compressor would need to be replaced (sold as one unit). This is tricky to diagnose and could take some time - you need to do it when ac is blowing hot air but set to max cooling.
2. Low on refrigerant or refrigerant has moisture in it? If your ac blows cold initially after being off for a while, then heats up, and continues to regularly cycle back and forth between hot and cool air, then the system may be low on refrigerant or the refrigerant may have moisture in it that is freezing and restricting refrigerant flow. An a/c shop can check refrigerant level and even replace refrigerant if moisture is suspected.
Could be other issues, but I would start with these.