Before update with One UI version 4.1 and Android version 12, Flashlight set up to "Top key" worked flawlessly on locked screen with enabled "Use while screen locked".
Sadly since I upgraded to One UI 5.0 and Android 13 update, Flashlight stopped working with "Top key" on locked screen. Now it works only when I unlock screen, which the button has no use.
Maybe next update it will be fixed ?
Because I tried disabling "Use while screen locked" and then re-enabling it. Sadly, didn't worked.