Removing a ufw rule by retyping it exactly is annoying. You do not have to.
sudo ufw status numbered
sudo ufw delete 3
The first command prints every rule with a number in square brackets. The second removes the rule with that number. Per the man page, that is the documented way to do it.
Two things trip people up. First, the numbers shift. Delete rule 3 and the old rule 4 is now 3, so run the status command again before the next delete, or you remove the wrong one. Second, with IPv6 enabled each rule shows up twice, a v4 line and a v6 line. Deleting by number removes only the line you named. The man page notes that to remove both, you prefix the original rule with delete:
sudo ufw delete allow 8080/tcp
That second form is the one I prefer when I know the rule. The numbered one is for when I do not remember what I typed three months ago.
Caveat: do not delete your SSH rule on a remote machine. Check which number is which before you press Enter.
Further reading: ufw(8) man page (Ubuntu 24.04), On this site: ufw show added lets you check your rules before you enable the firewall, On this site: ufw limit slows down anything hammering your SSH port