Need to replace the 02 sensor in my 2002 Nissan Altima, does that have anything to do with the heater blowing cold air?
Nope. O2 sensor sense how much emission is coming out of your engine. Engine thermostat and heater control valve controls how much hot water enters you heater core for heating.
For the heat problem it would be a good idea to check the coolant level while the engine is cold and make sure it is topped off. If there isn’t enough coolant in the system it can cause heat trouble. The trouble could also be due to a problem with the vent doors not working properly.
I would address the heat problem first. That might make the O2 error go away.