The fact that both problems started occurring frequently after upgrading to macOS 27 Golden Gate is worth noting, especially since they were not occurring before the upgrade. That timing does not, by itself, establish that the upgrade is the cause.
When the Dock becomes unresponsive, try Command-Tab to switch between applications and Control-Up Arrow to open Mission Control. If those continue to work while the Dock does not respond, that would indicate that the problem may be limited to the Dock or part of the macOS user interface rather than the entire system.
Also note whether the problem occurs with all applications or only certain ones, and whether restarting the Mac clears it temporarily or whether the problem returns after some use.
Apple: Switch between apps
Apple: Mission Control
Restart the Mac and check System Settings > General > Software Update for any available update.
If the problem continues, Safe Mode is a useful diagnostic step. It can help determine whether software that loads during a normal startup may be contributing to the problem.
Apple: Safe Mode