Mail: you can send the letter whenever, and the person will deal with it when convenient.
Phone: don't call someone when they might be asleep, but if you work nights unplug your phone during the day.
It's more complicated now, though, because the new ways of contacting people all boil down to "a message goes from your phone to theirs" and their phone may or may not be configured to let them know about the message. I think the rules basically come down to:
If the default configuration is either always silent or has a nightly "quiet period" then you can send whenever and not worry about waking people.
Otherwise treat it as if it will wake people up unless you happen to know that this particular person has configured their app differently.
In the first category we have email, Slack, and probably some other apps. In the second we have phone, SMS, Whatsapp, FB Messenger, Hangouts, Signal, and almost everything else.
Overall this is a bad equillibrium: it would be better to at least have the option to send your message whenever, and if the person is asleep they'll get it in the morning. The receiver has a much better idea of when are ok times for notifications than the sender does . But there's currently no way to know how someone has their device configured, so you generally need to stay on the safe side and wait for a reasonable hour before sending.
If we did successfully move from "sender guesses do-not-disturb" to "receiver's device tracks do-not-disturb", however, it would be good to have some sort of override. For example, if you called me in the middle of the night ideally you would get an automated message saying that I'm asleep, but offering you the option to press a button to get reach me if it's urgent enough that you want to wake me up. Systems where calls from trusted contacts bypass do-not-disturb don't do this well: not every late-night call from my sister is intended to wake me up, and there are people who may need to contact me urgently that I won't have thought to configure in my phone.