How to select a target in a scene while dragging an image from the UI?

I guess there could be several solutions but the first I would try would be to make a line trace from your mouse cursor and from the hit result get the object.