There are different implementations with their own pros and cons.
I've tested this one with both IPv4 and IPv6:
https://openwrt.org/docs/guide-user/firewall/fw3_configurations/dns_ipset
fw4 is based on nftables providing own built-in IP set implementation which is incompatible with the old IP sets.
Although configs and some commands may keep the word "ipset" in their name, they no longer use the old IP set back-end.
The problem is that dnsmasq 2.86 does not support the new IP set implementation.
Check the above link, it works for me.