I find my 32" 4K scales poorly in macOS, basically I can have everything tiny or everything massive and the scaling options make no sense there's only 720p, 1080p, 1600x900 or 4K.... there is no option between 1920x1080 and 3840x2160.
In Ubuntu it is more flexible but I think the sweet spot is going to be a 6K for scaling the UI at 3K but those might be a year or two away from existing and affordable. At below 30" 5K would be fine, I have a 25" 2.5K monitor that is very comfortable to use.
If you're not using a discrete GPU, that addition very possible will open up some more HiDPI resolutions for you. With a modest RX-460 (recognized in 10.13+) I get a variety of formats starting from a 2560x1440 layout over 3840x2160 pixels, and incrementally more spacious, all still over 3840x2160 on the wire, all with excellent HiDPI rendering. My intel graphics iGPU delivers just the limitations you described.
In Ubuntu it is more flexible but I think the sweet spot is going to be a 6K for scaling the UI at 3K but those might be a year or two away from existing and affordable. At below 30" 5K would be fine, I have a 25" 2.5K monitor that is very comfortable to use.