Here are some basic steps to follow, but isolating the cause might be an exercise in frustration.
- A Mail Rule that is not responding will cause that. If you are using any Mail Rules, try temporarily disabling or removing them: Use rules to manage your email inbox in Mail on Mac - Apple Support
- Rebuild selected Mailboxes, or all Mailboxes, according to Rebuild mailboxes - Apple Support.
- Rebuild that Mac's Spotlight index according to How to rebuild the Spotlight index on your Mac - Apple Support.
- Boot "Safe Mode", log in, launch Mail, then shut down or restart normally: Use safe mode to isolate issues with your Mac - Apple Support
- Temporarily stop using an email account: (Apple menu) > System Preferences... > Internet Accounts > select your email service, and de-select Mail. Wait a moment or two, then select it again. Repeat for each email account you use, testing after each one.
- If all else fails, temporarily remove that Account from that System Preferences pane, and then add it again.
The last two suggestions are described in greater detail here: Set up Mail with email accounts - Apple Support.
Create a backup if you haven't done that already. To learn how to use Time Machine please read How to use Time Machine to back up or restore your Mac - Apple Support. That doesn't have anything to do with your Mail difficulties; it just goes without saying that you should have a backup.
Also, if you are using any non-Apple "anti-virus", "cleaning", "washing", "maintenance" or similarly categorized junk on your Mac including "Internet security" or "banking security" products, don't. That also just goes without saying.