By default, Apple’s iPhones and iPads make a sound when you turn their displays off (aka when you “lock” them). You can disable this sound entirely and never hear it again, or just silence your phone if you’d rather not hear it in certain situations.
You can disable this sound from the Settings app. To do so, open the Settings app, scroll down, and tap the “Sounds & Haptics” option. On iPads and older iPhones, tap the “Sounds” option instead.