The best way to achieve this is by creating an account on NextDNS, then setting your phone to use the NextDNS DNS. On the web dashboard, look at the logs and blacklist anything from Google, Google Play, or anything else you don’t want. This not only works but also gives you more control over everything your phone is doing in the background, regardless of whether you’re using Wi-Fi or a mobile network.
It suffices for me if you don’t enable logs; there are no logs… and if you enable them, you can choose the country where the logs are saved and for how long.