Sometimes things like this can occur after a recent system change or new program is installed.
If you were not experiencing this issue previously you can use system restore to scan
for programs that will be affected if you would do a system restore to an earlier date.
Remove these programs the would be affected if your were to restore your system to the previous
point where your system was working fine.
Reboot and see if the problem persists.
Edit. Just saw this posted if you running windows 11.
More fixes for system and app freezes
Microsoft has fixed a long list of issues impacting Windows 11 in a newly released build for Windows Insiders in the Beta and Release Preview Channels.
www.bleepingcomputer.com