That will definitely work for a
Pi-Hole or
AdGuard Home. If it has 2 network controllers, you could even set it up as a router and firewall with
OPNsense. That would allow you to do even cooler stuff like
DNS packet redirection for devices/applications that have a hardcoded DNS server.