Both can provide high-quality drinking-water treatment. The real decision is installation, output, footprint and how much appliance convenience you value.
You rent, cannot drill, want plug-in setup, value hot/cold dispensing or may move the system later.
You want higher continuous faucet flow, a cleaner countertop, larger household capacity and are comfortable with plumbing installation.
Countertop units often bundle electronics, heating and dispensing features into the purchase price. Under-sink systems may cost less for filtration hardware but more for installation. Compare replacement cartridges over several years.
If installation is not a problem, under-sink RO usually wins on flow and invisibility. If installation is the problem, countertop RO is often the better real-world purchase.