Chevy s10 problems


My 2003 S10 ZR5 is consuming a lot of gas. I understand that with a 4.3L V6 it’s gonna eat a good amount, but I’m not even getting 18mpg. The service engine light came on and it was an O2 sensor, I also believe that my 4wd isn’t working or locked on. Is there a way to check to see if it is locked, and if so is this going to be an expensive repair?