Android or iOS?
If you're on Android I use AdAway, fantastic and open source. Can be used with and without root, though the non-rooted way has to run as a "local VPN" vs taking control of the hosts file directly
iOS, I'm not sure, it's been many many years since I've last needed to deal with an iOS solution lol
It's been pretty good at blocking in-app ads, but it can be problematic in some, but a list of what to whitelist is maintained here: https://github.com/AdAway/AdAway/wiki/ProblematicApps