This is a problem I have been having for a while and I thought I had fixed it but it has recently returned.
Sometimes my raspberry pi will lose connection on a random device. Sometimes it’s tailscale, sometimes it’s wlan, sometimes it’s both. It still shows as connected in my router even when it is unreachable. When I can access it through one device while the other is down I check for errors but can’t see any. If left alone for long enough it will fix itself (today it fixed itself after 6 hours) or I can reboot if I still have access to ssh through a working device.
To fix it last time I fixed wireless localisation settings (it was set to us instead of gb) but it being fixed after that change might have been a coincidence.
My only idea for why it doesn’t always work is because of a range extender I have upstairs (where the pi is) which is connected to the network using fritz! mesh. I think it’s a bad idea since it is placed very close to the main router (almost directly above) but my dad insists on having it.
I had a similar problem, it was caused by undervoltage. Are you using the official power supply?