If you're reimplementing DNS lookups with caching in your own code, you are very likely doing something wrong.
The title of the entire story already had me confused, as it suggests you somehow need DNS for UDP. Everything that is presented here is a caching strategy.
I haven't read the article yet but the problem I had back then running into UDP with DNS on K8S is that it might consume the UV thread pool and exhausted it.
There is only 4 UV threadpool, and DNS resolution use it. When using service with low ttl or if for wahtever reason bug or something and if node has to resolve DNS every time under highload, it's very quickly consume all of thoese 4 UV thread pool.
As another commented pointed out the "solution" only uses a single IP, even if the resolver returned multiple.
I would not use this in production.