LineageOS (and its ancestor CyanogenMod) has a history of breathing new life into old Android devices, and that's truer than ever in 2019. The developers have released LineageOS 16, a ROM that introduces Android 9 Pie to devices that in some cases stopped receiving official updates years ago. The initial 30 supported models includes hardware from as long ago as 2014, including the Samsung Galaxy S5 and OnePlus One.
There are newer devices that can use LineageOS right away, such as Huawei's P20 Pro, Samsung's 2016-era Galaxy Tab S2 tablets and Xiaomi's Pocophone F1. Wider support is on the way, Lineage added, and there's even a bit of future-proofing: hooks in LineageOS should make it compatible with Android's expected dark mode.
As always, you have to be willing to install unofficial code. This isn't for people who absolutely need a reliable phone for work. If you're comfortable with a bit of tinkering, though, this could help you postpone a hardware upgrade for another year or two.