All Game objects behind the button is also getting click

I have this button that’s on top of a game object that function when getting click, if the button is on top why the game object behind works like its also getting click. OnClickHide() is the function of the button.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class Displayer : MonoBehaviour
{
private GameObject itemDisplayer;

void Start()
{
    itemDisplayer = GameObject.Find("ItemDisplayer");
}

public void OnClickHide()
{
    itemDisplayer.SetActive(false);
}

}

Fix it I use IPointerClickHandler on the object behind and add 2d raycaster to the main camera. If you have any other suggestion fell free to comment i,ll just leave this here.