Go to settings>focus and create a new category with "add focus" (mine is called "work")
Add apps that you want to allow to show notifications (mine has only calendar, and a "pomodoro timer" app)
That's it.
If you need a variation of this, you can add a different category (ex: I have another one where I also allow incoming calls from some people/apps)
You can change the focus setting on the right side of your menu bar