The find familiar spell description states:
When the familiar drops to 0 hit points, it disappears, leaving behind no physical form. It reappears after you cast this spell again.
While your familiar is within 100 feet of you, you can communicate with it telepathically. [...]
As an action, you can temporarily dismiss your familiar. It disappears into a pocket dimension where it awaits your summons. [...] As an action while it is temporarily dismissed, you can cause it to reappear in any unoccupied space within 30 feet of you.
The Ranger's Companion feature description for the Beast Master ranger has nothing suggesting any form of supernatural communication.
So if a familiar or companion dies away from the caster, on a scouting mission or something, is the caster aware?