Only get sound notifications from contacts and certain apps
Info
You could be better off with another approach like for example:

Set the notification sounds for SMS and ringtone to an empty audio clip. (no sound)
Add all your contacts to a contact group.
Set your preferred SMS/ringtone sounds for that entire contact-group.

This may be better for long term use since it won't hide and silence notifications of all installed apps.
Note: This may depend on your phone make/model/firmware.
Answering your question
I'll use Skype as an example.
Open app info for skype
Settings-&gt;Apps-&gt;Skype
Notification settings
Select notifications, then tap the name of any notification category (not the toggle switch).
Then toggle (enable) the option named Ignore do not disturb at the bottom the list.