In the VPN app. Look for options named DNS leak protection, use VPN DNS or similar and turn them on, together with the kill switch that cuts the connection if the tunnel drops. If the app offers WireGuard or OpenVPN with its own DNS, prefer that over manual setups.
Windows. Windows can send the same DNS question over every network adapter at once and use the fastest answer, your provider's included. The feature is called smart multi-homed name resolution. Good VPN clients neutralise it; if the leak persists, disable it with the group policy Turn off smart multi-homed name resolution, and make sure no DNS servers are hard-coded on your physical adapter.
macOS and iPhone. An installed encrypted DNS profile, or an app that sets one, can take precedence over the VPN's DNS. Turn it off while the VPN is on, or let the VPN manage DNS.
Android. Open Settings, Network and internet, Private DNS (the path varies a little between manufacturers). If a specific provider is set, lookups go there instead of the VPN's resolver. Choose Automatic or leave DNS to the VPN, and enable Always-on VPN with Block connections without VPN.
Browser. Firefox, Chrome, Edge and Brave can use their own secure DNS (DNS over HTTPS), which bypasses the system and the VPN. The test then sees your browser's DoH provider rather than the VPN's resolver. If you want the VPN to decide, switch secure DNS off in the browser's privacy settings.
Router. Some routers intercept every DNS query on the home network and hand it to the provider's resolver, whatever you configured. If the leak appears only at home and disappears on mobile data, the router is the likely cause.