How can I use Logitech Options to lock my screen with my MX Ergo?
In Logitech Options, you can assign a keyboard sequence to a button.  For this example, I assigned the top button  on the side (the one highlighted in green) the shortcut to lock the screen CommandControlQ.



Now, when I press the button, it's as if I've pressed the keyboard shortcut.