Recipe
$ sudo ufw insert 1 deny from [ip-to-block] to any
The 1
above shows the order of the insert.
You can insert a rule without an order numeric:
$ sudo ufw deny from [ip-to-block]
If you’ve already inserted a rule and it doesn’t work, check the order as per the sequence below:
Show all rules
$ sudo ufw status numbered
Delete Rule
First Show all rules
$ sudo ufw delete 19
Reference
https://serverfault.com/questions/484475/ufw-firewall-rules-ordering