I've never used the "Stay awake" option, but I had the same issue a while back when "Unknown sources" wouldn't stick, I'd enable it and after a couple hours it was disabled.
I ended up backing up my phone using Samsung Cloud, then doing a factory reset, restored my backup from Samsung Cloud and issue was solved, Unknown sources has been enabled and hasn't disabled itself since.
I did turn on the Stay awake feature after reading your post to test and see if it turns itself off, how long before it turns itself off? a couple hours, a day or 2?
I dont know how long and when...I didnt monitor that...I will But more then that, the function is not working...from what I know from prev experience this stay awake, should keep the screen on if my phone is charging...and now it's not doing that...the screen turns off...so its a bug
I don't think it's a bug , "Stay awake" works only when the phone is charging , the screen will not sleep during Charging. If you need the display not to go to sleep, that option is in Display settings under Screen Time out , here you will have options from 15sec to 10 mins.
@A1 is correct that option is only meant to work when your phone is charging or attached to USB. If you have Bixby on your phone, just tell her not not to turn off your screen for let say 10 mins (or until you want screen on) and she'll change that setting for you.