i think you can do it with phone setting
Tap Settings > Sound > Do not disturb > Priority only allows, then pick some options. For example, you can set "priority only" to include incoming calls and texts from contacts, reminders, event alerts, and repeat callers. To restrict call and text alerts to your innermost circle, make sure Calls and Messages is set to Starred contacts only, then go through the Contacts app and star only those contacts who really, truly matter to you. Finally, a Repeat callers setting will allow a caller to get through if they've called twice within 15 minutes.
To enable Priority mode, flick down from the top of the screen to reveal Quick Settings, tap Do Not Disturb, then make sure the Priority only tab is enabled.
Finally, sit back and give your full, undivided attention to a (grateful) friend.
Note: Android's version of Do Not Disturb boasts three different modes: Priority Only, which blocks specific alerts for apps, calls and texts; Alarms Only, which blocks all alerts except for the Android alarm clock; and Total Silence, which blocks all alerts, no matter what. While the Alarms Only and Total Silence modes will guarantee you a peaceful lunch hour, they may also block critical alerts, calls or alarms. In general, you should stick with Priority Only mode unless you're certain you don't want any interruptions, period.
if you are looking for app that blocks notification :