Why does Input.mousePosition return a Vector3?

I’m trying to use the function properly, as I understand the x and y coordinates to be the screen’s (x,y) position, but what’s the purpose of a z coordinate?

The z coordinate is always 0 for mousePosition. You can also use functions such as ScreenToWorldPosition with a camera, which will get the position in the world that your mouse is floating over. It’s just convenient to do it like this, I suppose.