UI buttons work definitely and have their own input system. Best workaround for this is to disable the UI elements/screen unless the player is near them or use non-UI entities for buttons/input.
There’s no real practical way to block UI input with world objects.