For one thing, it could delegate to a local service. Granted, the communication to this service is probably still be over a socket interface, but at least as a purely-local connection you would hopefully have some better worst-case performance characteristics.
This is basically what dnsmasq does when you use it as a local DNS cache.
This is basically what dnsmasq does when you use it as a local DNS cache.