How do i use user input service for both mobile and pc?

I am trying to use userinputservice on a gui, but the problem is that i can’t detect tell if the player’s mouse/finger is inside the gui and nor can i tell which direction the mouse/finger is moving.

for an example if the player swipes up on the ui the object rotates up

and basically i want the player to interact with the 3d object inside ui on their screen.