You can check the auto-dimming and auto-brightness settings to make sure they're not affecting you.
Auto-dimming is in the "display and brightness" system preference (but that only affects when you don't touch the screen, so probably not your problem)
Auto-brightness is kind of hidden, look in General --> Accessibility --> Display Accommodations. If you are somehow blocking the light sensors or cameras while using your apps, that could cause the display to temporarily brighten or darken when you move your finger or phone (I have a habit of resting my ipad on my stomach while I read, and sometimes my shirt overlaps and causes the screen brightness to change).
But some apps will adjust the brightness themselves. It's possible that the app you're using does this, and has bug that causes it to get stuck somehow. If you notice this happening while using (or after using) certain apps consistently, then you should report the bug to the developer of that app. I suspect this is your problem, because you're saying that the brightness slider gets stuck - usually restarting the phone will clear it up, until the next time you use that app.