2002 subaru forester surges and hesitates

In point number 5 of your original post you state “but Subaru doesn’t have mass airflow sensor.”

I think perhaps the engine does have a MAF. On my Subaru the MAF is adjacent to the air filter box.

I’m in agreement with VDCdriver’s advice about the MAF or the Idle Air Control.

In addition, if the O2 sensor is not functioning correctly it should be replaced. The O2 sensor(s) are very important for correct engine operation. They DO wear out with time.