How to reliably check if button is being pressed?

By reliably I mean in a way that it will not fail.

I have a 2 functions that set a bool state to true or false. They are being called PointerDown and PointerUp. But when I run the UI on mobile devices it is very often that the button leaves the boolean to true even when it is not pressed.

This is very hard to simulate on pc/mac, but every now and then when you click on the button rapidly it is left to true.

How to implement similiar feature like isOn with toggles to see if button is being held down and reliably detect when it is released?

Any advice would be greatly appreciated!

I made some further tests and it seems to be editor side visual bug. bool is actally False but the visualization on editor side shows it to be true. I will make bug report out of it.