Modern programs should use getaddrinfo(3). The glibc implementation of that call will first consult the "hosts:" line of /etc/nsswitch.conf. That file will contain a list to determine how host names are resolved:
The first entry is typically "files". That means consult /etc/hosts file.
Next there could be something to consult avahi/autoip, Ubuntu systems typically do that.
There could also be entries "myhostname" and "mymachines". That's systemd's container support, not discussed here.
If the system uses systemd-resolved there will be an entry "resolve". Than means consult systemd-resolved
Typically the last one is "dns". That's the traditional implementation using /etc/resolv.conf. But if systemd-resolved is configured and working we never get here.
Only if you don't have "resolve" before "dns" in your /etc/nsswitch.conf then /etc/resolv.conf is still relevant.
It appears to me that musl does not use /etc/nsswitch.conf at all, so there /etc/resolv.conf is still relevant.