Sprites doesn't block Raycast from UI

Hello,
I have sprites and background behind them in a CameraCanvas.
The problem is when I click on a sprite has a collider component the Raycast click also on the background that must have a different function.

note: I can’t make the background sprite because it’s tiled.

I didn’t found a solution to block raycast from UI but you could do this by scripting.

See:

Hope this help.