Set Screen Saver Timeout and Lock Screen

Windows 10 & 11

Go to Settings  > Personalization > Lock screen, and select Screen saver settings

In the Screen Saver Settings window, choose a screen saver from the drop-down list.

Ensure you tick the "On resume, display lock screen" option.

Save, and exit.