I take it from your description that you are trying to set Pi-hole as your Android's custom DNS.
If your Android is connected to your home network via WiFi, there is no need to use this Android option, as you can configure your router to use or distribute Pi-hole as DNS server, or have Pi-hole act as DHCP server doing the latter in case your router doesn't cooperate.
The fact that your Android requires a hostname for custom DNS configuration also suggests you are on Android 9 or higher, where setting a custom DNS server is restricted to those DNS servers supporting DNS-over-TLS, and you no longer can configure individual DNS servers for specific networks.
This wouldn't affect your home network, as that advertises Pi-hole as DNS server to your Android.
However, you wouldn't be able to access Pi-hole via your carrier's mobile data connections - which is perfectly normal. regardless whether you would use an IP address or a hostname to access your Pi-hole, since Pi-hole is operating in your home network only.
Any steps you take to allow indiscriminate access to Pi-hole from public networks (as your carrier's mobile data net) will turn your Pi-hole into an open resolver, which poses a potential threat for all Internet users, e.g. by serving as a multiplier in a DNS Amplification attack.
The Pi-hole team strongly discourages Pi-hole’s usage as an open resolver , and we won't provide support in that case.
As @cmgeek has pointed out, VPN access is a much better and safer way to use Pi-hole as your mobile device's DNS server when connected to public networks. There's a wealth of choices available when picking a VPN for yourself, including Pi-hole's guide on Pi-hole and OpenVPN.
In such an environment, your Android device would join the VPN and again receive Pi-hole as DNS server via DHCP, so no need to use Android's custom DNS option.