Working, yes. Getting OS updates? Probably not.
I have a Sony Xperia Z5 Compact bought in 2015. It works fine except it has not received any OS updates since 2017. Supposedly it's down to Qualcomm not providing updated drivers for the chipset. I'd like to get a new one but the current phones in this size (something that fits in a shirt pocket) seem to be dowgrades.