Context: Both systems are discontinued. This comparison reflects their full lifecycles to inform used-market buyers in 2024.
The 3DS is the better used buy for most people. Larger library, true portability, lower cost, durable cartridges. Buy a Wii U only if you must play its handful of unported exclusives (primarily Xenoblade Chronicles X, Tokyo Mirage Sessions, The Wonderful 101—though the latter two are on Switch). Many Wii U gems are now on Switch, often in superior versions.