There is no generic “whitelist” and no generic “firewall”. If it is about whitelisting inside a stateless or stateful packet filter then information about the actual domain are not available at this level. If it is about deep packet inspection or application gateways (like a mail gateway or web gateway) then this information might be available though, depending on the specific application protocol and the specific use case.
Thus the theoretical possibility to whitelist by domain instead of IP depends on the specific context and use case and the depth of inspection done. In practice firewalls also might or might not have this capability even if it could be theoretically done.
Since no details are known about your specific use case and context and the capabilities of your specific firewall the question cannot be answered in more detail.