Well, on linux I’d use systemd’s resolved which would listen on localhost:53 (it would also point resolv.conf there) and then set resolved’s uplink server to your custom port. I don’t have the exact config in mind but it seems to support custom uplink ports(“expects IPv4 or IPv6 address specifications of DNS servers […] optionally take a port number separated with “:”[…]”)
Edit: found this: https://en.opensuse.org/Network_Management_With_Systemd
see systemd.unit(5), systemd.service(5), systemd.socket(5), systemd.device(5), systemd.mount(5), systemd.automount(5), systemd.swap(5), systemd.target(5), systemd.path(5), systemd.timer(5), systemd.slice(5), systemd.scope(5) systemd.link(5), systemd.netdev(5), systemd.network(5) and honorable mentions podman-systemd.unit .container, .volume, .network(…again), .kube, .image, .build and .pod