Prevent click on part of gameobject once dragging

I have two different independent scripts:

  1. Is rotating cube with OnMouseDrag() function
  2. I want here to select part of cube ( big cube consist of little parts like rubick)

Problem:
Rotating works as expected, but in the second script in Update() function I have to select one of part of that cube and so I have if statement with condition when mouse button pressed down.
So basically when I’m dragging I also selecting one of that parts.

Looking for a solution on how to prevent that.

On mouse down just detect the mouse position, then move the part selection code to On Mouse Up, and only select the part if you haven’t moved the mouse