Log into another vanilla admin user account, Set up users, guests, and groups on Mac, and see if the problem persists. (This tells us if the problem is limited to your user account or is system wide).
If it does then boot into Safe Mode (How to use safe mode on your Mac - Apple Support) by booting with the Shift key held down and check there to see if the problem persists. Reboot normally and test again.
NOTE: Safe Mode boot can take up to 10 minutes as it's doing the following;
• Verifies your startup disk and attempts to repair directory issues, if needed
• Loads only required kernel extensions (prevents 3rd party kernel/extensions from loading)
• Prevents Startup Items and Login Items from opening automatically
• Disables user-installed fonts
• Deletes font caches, kernel cache, and other system cache files
Have you run any "cleaning", "optimizing", "speed-up" or anti-virus apps on your Mac? If you have then download and run Etrecheck. Etrecheck is a diagnostic tool that was developed by one of the most respected users here in the ASC and recommended by Apple Support to provide a snapshot of the system and help identify the more obvious culprits that can adversely affect a Mac's performance.
Copy the report
and use the Additional Text button to include the report in your reply.
IMPORTANT:
Before running Etrecheck assign Full Disk Access to Etrecheck in the Etrecheck's Privacy preference pane so that it can get additional information from the Console and log files for the report:
Also click and read the About info to further permit full disk access.
Then we can examine the report and see if we can determine what might be causing the problem.