It is absolutely correct if your camera is orthographic and pixel-perfect, otherwise to make it compliant with current camera VP setting use this: Unity - Scripting API: Camera.ScreenToWorldPoint
If there is a need to use that with perspective camera I recommend to set plane(or better - quad) with collider and cast ray to that plane. That way you will have full control on movement plane without the need to mess with projection math and overcomplicating code.
The good helper in that is Physics.Raycast: Unity - Scripting API: Physics.Raycast
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if (Physics.Raycast(ray, out hit, 100)){
transform.position = hit.point;
}
Take note regarding two things:
If y looks reversed in comparison to screen just perform flipping of it by Screen.height.
You may need to add mask to make sure in this pass only plane is detected instead of other colliders. Experiment