Hi AndriotMiller,
Thank you for contacting Apple Support Communities. Based on what you stated, it seems like the side button on the iPhone 11 is not working to put the iPhone to lock, but it works at other times. There are a couple things you can try that may be able to help. We would recommend you read these articles and use them to help troubleshoot the issue.
Update your iPhone, iPad, or iPod touch
How to back up your iPhone, iPad, and iPod touch
Restore your iPhone, iPad, or iPod to factory settings
If a button or switch isn't working on your iPhone or iPad
Please don't hesitate to let us know if the steps resolved your issue or if you need additional assistance.
Cheers.