How to block clicks in UI from interacting with background?

So I have a circle in 2d which I’m rotating by just dragging to mouse around on the background(everywhere basically). But I made a UI now with a draggable button, and whenever I click or drag the button, the circle in the background also responds to it. How can I stop this?

Appreciate all suggestions.

The EventSystem created along with your Canvas lets you do that:

if (!EventSystem.current.IsPointerOverGameObject())
{
	// Cursor is not over UI
}

https://docs.unity3d.com/ScriptReference/EventSystems.EventSystem.IsPointerOverGameObject.html