What is the difference between upstream and downstream O2 sensors?

The upstream (pre-cat) sensor monitors exhaust gases to help the ECU calculate fuel trim. The downstream (post-cat) sensor monitors catalytic converter efficiency. They serve different functions and are not interchangeable even if they look identical.