You should escape outputs, of course (not that anyone in 2022 thinks otherwise).
Why escaping outputs alone won't work is because user inputs will be stored in some database and you can't realistically predict how, when, where it will be used. Years in the future. User name could be used as a filename once, opening up possibility of shell-based exploit. It could trigger a little-known spreadsheet formula vulnerability when exported for analysis. Novel, interesting xss attacks are common and produced every day. That could be even not your code, but the code your client or partner organisation run. You just never know.
One common defence is user names (and other freeform fields) should not be allowed to be arbitrary bytes.
That is defence in depth, an established practice.