According to my information, it is better not to use the command:
iptables -A INPUT -s example.com -j DROP
example.com will be replaced in realtime with an ip address, which will not cover all possible ip addresses.
But if I use:
iptables -A INPUT -m string --string "example" --algo kmp -j DROP
Taken from this answer and I tested it myself, then I no longer need to worry about ip substitution, because "example" will match "example.com" and it will block it.
iptables only works with ip addresses, why does it work on names in the second case?