systemd-resolved probes the DNS servers it uses and remembers what each one can do. If a server had a bad moment, that memory can outlast the problem.
First look at what it knows:
resolvectl show-server-state
That shows detailed server state per DNS server, and you can add --json=pretty for a version a script can read. Then clear what it learned:
sudo resolvectl reset-server-features
The manual says this flushes all feature level information the resolver learnt about specific servers, and probing starts again from the beginning with the next lookup. It is mostly the same as sending SIGRTMIN+1 to the service, which helps when you read older posts.
I would try it after a router or upstream DNS change, or when a server answers fine with dig and still fails through the system resolver.
Caveats: it does not empty the answer cache. For that you still need resolvectl flush-caches, and the two together give you a fresh start. The versions differ too. According to the manual reset-server-features was added in systemd version 239 and show-server-state in version 255, so on a distribution in between you can reset the servers but not look at their state first.
Further reading: resolvectl(1) manual