Correct way to block mouse clicks on the UI from being acted upon by the main game?

Hi,

If I have an interactive user interface in-game (think SimCity, the Sims or an in-game level editor…), where the mouse is used to interact with the 2D UI and the 3D game world, what is the correct way to stop the mouse clicks being used by the game world if the player was clicking the UI over the top?

I see posts about IsPointerOverGameObject(), but this seems to be an API that dates back a long time and is no longer in the documentation. Is it still the way to go, or is there something newer or better?

Thanks!