How can I easily and fast find if a certain gameObject is UI or not ?
Check if the GameObject contains a RectTransform component on it because UI element game objects have a RectTransform component attached to it as opposed to other objects which have a Transform component.
if(gameObject.GetComponent<RectTransform>() != null )
{
// This is a UI element since it has a RectTransform component on it
}