Sometimes one network has to go through a different router than everything else, for example a lab subnet behind a second box. You can test that route live before you write it into netplan or NetworkManager.
ip route add 198.51.100.0/24 via 192.0.2.1
ip route show
Traffic for 198.51.100.0/24 now goes to 192.0.2.1, and the rest still uses your default gateway. The gateway has to be reachable on one of your directly connected networks, or ip refuses with Nexthop has invalid gateway.
When you want to point the same subnet somewhere else, replace saves you a delete first:
ip route replace 198.51.100.0/24 via 192.0.2.2
ip route del 198.51.100.0/24
replace also creates the route when it does not exist yet, which makes it handy in scripts that may run twice. To check which way a single address really goes, ip route get 198.51.100.7 answers with the route the kernel picks.
I like this order: add the route by hand, test it, and only then make it permanent. A route added with ip disappears at the next reboot, and NetworkManager or systemd-networkd may also drop it the next time they reconfigure the interface. Once it works, put it in the config of whatever manages your network, so the two never disagree.
Further reading: ip-route(8) manual page