clicks pass through UI elements on android

I have 2d objects that respond to mouse clicks. There is a UI panel For the whole screen and when I click on this panel, clicks are triggered on objects under the UI panel. How to fix it? I do it on the phone. Unity Version 2019
This code works on a PC, but not on a phone
public void OnMouseDown()
{
if (EventSystem.current.IsPointerOverGameObject() || EventSystem.current.currentSelectedGameObject != null)
{
}
else
{
WoodFarmPanel.SetActive(true);
}

    }

@Urtay On the rear panel make sure it is has an Image component and it’s “Raycast Target” set to true. This will consume any clicks that would pass below.