Editing the network config of a remote server is one of those jobs where a typo means a drive to the datacenter. Netplan has a safety net, and many people skip it.
sudo netplan try
It applies the new configuration, then waits. If you do not confirm within 120 seconds, it reverts to the old one. Press Enter to accept the change. That is from the man page, and the timeout is configurable:
sudo netplan try --timeout 30
The scenario it saves you from: you change the IP or the gateway over SSH, the session freezes, and you cannot reach the machine to undo it. With try you wait for the countdown to run out and the old network comes back by itself.
I would use it every time on a remote box, even for a change I am sure about. Typing netplan apply is for the moments when I am physically in front of the screen.
Caveat: the revert only helps if you finish the change inside the window. A DHCP lease that takes a minute to arrive, or a router that needs a moment, can eat the time. Raise the timeout when that applies.
Further reading: netplan-try(8) man page (Ubuntu 24.04), On this site: netplan status shows what the network actually looks like right now