I'm going to take a stab in the dark here and point the finger at IPv6.
Are you using IPv6 in your LAN? Do you have IPv6 addresses configured in your local DNS server?
There are many subtleties to IPv6 vs. IPv4 and while the default OS settings seem to work for most people, you may be the exception.
Since you mention resolv.conf and hosts, I'll assume you're competent in the shell, which makes this a little easier.
First, a couple of tests.
In terminal, run:
dig
at the bottom of the output (ignore the stuff in the middle for now), it will tell you the address of the server used for the query:
;; Query time: 9 msec
;; SERVER: 2600:1700:1155:3120::1#53(2600:1700:1155:3120::1)
;; WHEN: Tue Apr 29 12:00:56 PDT 2025
;; MSG SIZE rcvd: 811
Here you can see a SERVER: response with an IPv6 address, indicating that my system is using IPv6 by default.
Contrast that with:
dig -4
which forces an IPv4 query, and I get:
;; Query time: 9 msec
;; SERVER: 192.168.1.254#53(192.168.1.254)
;; WHEN: Tue Apr 29 12:02:21 PDT 2025
;; MSG SIZE rcvd: 811
and you can see the IPv4 server address.
Does this match your experience? or does your default dig use IPv4?
More importantly, do the IP addresses match what you expect for your DNS server?
If not, then we need to work out why your system is using a different DNS server (could be malware, could be misconfiguration...).
If they are correct, drill down to query a specific hostname on your lan:
dig localserver
dig -4 localserver
What do you get?
What do you get if you use a FQDN for your local server?
dig localserver.local
dig -4 localserver.local
(or whatever would be appropriate for your local network).
As the last test, turn off (at least temporarily) IPv6 in Settings -> Network -> <interface> -> Details -> TCP/IP -> Configure IPv6 and re-run the tests.
Hopefully that will be enough to target next steps. Once we know which is working (or not) we can figure out what to do about it.