How firewall ACLs evaluate packets
Network firewalls read access control list (ACL) rules strictly from top to bottom and stop at the first match. If a broad DENY rule sits above a specific PERMIT rule, the permit rule is shadowed and never runs.
When no rule matches a packet, an implicit deny (DENY any any) at the bottom drops it silently. When a firewall permits traffic to a server that is not listening on that port, the host itself replies with TCP RST (RFC 9293) or ICMP Port Unreachable (Type 3, Code 3, RFC 792). Note that DNS uses both UDP 53 and TCP 53 (RFC 7766).