Subaru revs in idle/ trouble accelerating

My subaru forester, 2002, with low mileage (40K) had routine maintenance 2 mos ago. Now sounds like it revs when in idle, and today began hesitating when I accelerate (a few seconds or so). I plan to take it in but wonder if there’s insight before I go in cold (I know nothing about cars). Read on forums could be 02 sensor.

There’s not enough info to go on to make any kind of guess. Making a wild guess for a moment, I might say there’s a vacuum leak and this could affect the idle and the MAF sensor both.
You state there was routine maintenance a few months ago so it’s possible that something could have been damaged or left loose. Eventually something can finish coming apart and you now have a noticeable problem. Not saying the shop is at fault; only pointing out a possibility and it’s also possible the maintenance had nothing to do with this.

You might consider getting a chain type parts house to scan the car for codes. They will do this for you free. If no codes are present I would examine the intake tract for dislodged or cracked hoses, leaking seals, etc.

At this point I would ignore the O2 thing. The O2 sensor is the whipping boy for all car evils and pretty much gets the blame for everything including the dog running away from home.