Almost certainly the front sensor, as this is what the codes point to, and the front sensor will affect your emissions.
The mechanic that suggested the rear sensor got it wrong, the code for that one is usually P0420 and it does not affect emissions, engine running, or anything else.
It...