To add to this … in light of @murgero’s comment (thanks!)
do
ufw status numbered
which will give you a numbered list of the rules. From that list you can then insert your deny rule in the correct place by using the command you were initially but substituting the 1 with the correct position.
This is supposed to be incorrect. However a bug is preventing it (and has been for years it looks like)
a patch was just recently proposed to ubuntu for this:
IPv6 rules cannot be inserted before ay IPv4 rules for now. but this will change in the future.
(However this might be irrelevant as IPv6 IPs are not processed against IPv4 rules so a deny rule for IPv6 just needs to be insert before all other IPv6 rules)