It is more complicated…depends on what you mean by “sharp” I guess.
The 1440p will be sharper but lower PPI. For example, if you display an alternating 1x1 pixel grid, it will be pixel perfect, perfectly sharp, however lower PPI so maybe perceptibly jaggy.
Meanwhile, EVERYTHING on the 5k2k set to “looks like 3008” is getting interpolated, so the 1x1 pixel grid will look like an artifacted mess. Details in generawill be smoother/blurrier.
Soo…what ends up looking “better”, including with respect to perceived detail, is a perceptual phenomenon that will depend on the scale of the details you care about, in addition to the difference in PPI (lower but not interpolated on the one hand, higher but interpolated on the other).
For me personally, for my use cases, I can tell you I prefer looking at a 140 PPI 40” 5k2k (even at these interpolated in between/fractional retina scaling levels) compared to a traditional 109 PPI 27” 1440P display.
Here are some examples:
https://gist.github.com/johncolby/70e4c52d845078f789b1fc23e3fb1cb0