UPD 1 - Now checks if the mouse is down AND if the threshold is passed. This project includes a one script mobile detection sprite. It works by finding the mouse position and then if the difference in position between two frame is greater than the threshold and the mouse is down, it will set the mobile variable to 1. This is a example of how it would be used in a 2d platformer-like game, with a pc mode (wasd) and mobile mode (joystick). You can change the threshold and see how the detection changes.
The joystick is from @griffpatch All other sprites are made by me.