You can use the Do Not Disturb feature on your iPhone whenever you want to silence any calls, texts, or other notifications.
You can mute messages on a Mac with a "Do Not Disturb" setting across your general notifications, or mute individual conversations in iMessage.