Try restarting in Safe Mode - Hold SHIFT immediately at startup and continue to hold until Apple Logo appears, then release. It does a Repair Disk, clear cache files and only loads Apple Software, extensions and fonts. It loads slowly - normal. Once logged in the computer will look and perform differently - also normal. Now Test if your issue happens or not.
Should the issue in question occur in Safe Mode - this maybe an indication of a User Account issue. If so, suggest creating a new test account and use it to Test again.
Should the issue Not Occur in Safe Mode - this maybe a indication of some Third Party Software playing up. Then suggest downloading the Application Etrecheck directly from a Trusted Developer and well Respected ASC Contributor. The application is free or paid from added features. Run the application with Full Disc Access ( Security & Privacy - Full Disc Access ). It will take a Snap Shot - both the hardware and software. The Report will Not Reveal Any Personal Information. Post back the Full Report - copy and paste - using the Additional Text Icon ( 3rd Icon to last )
We can have a look at the report for possible issues and may have possible suggestions to resolve the issues.
Any Third Party Applications that will interfere with the normal operation of the OS, alter, modify, remove or delete or attempt to do so is an invitation for disaster and may require a Reinstallation of the OS.