I have read the Unity3D documentation related to mouse input and touch input but was not able to find any information that would solve this doubt of mine. I have also gone through several YouTube videos where they use Input.GetMouseButton() but they too didn't provide any information that would help me with this problem. Take a look at this snippet, where the else-if executes when I drag on the screen, and not the if statement.
public bool isDragging = true;
if(isDragging)
{
if(Input.touches.Length < 0)
swipeDelta = Input.GetTouch(0).position - startTouch;
else if (Input.GetMouseButton(0))
{
swipeDelta = (Vector2)Input.mousePosition - startTouch;
}
}