How do I drag an object along the x axis between two points?

My camera is fixed in my 3D game and my object moves when I drag it but it can go off the screen, I want to set boundaries as to how far it can move. Here is my current code

{
	bool dragEnabled = false;
    Vector3 dragStartPosition;
    float dragStartDistance;
    void OnMouseDown()
    {
        dragEnabled = true;
        dragStartPosition = transform.position;
        dragStartDistance = (Camera.main.transform.position - transform.position).magnitude;
    }
    void Update()
    {
        if (Input.GetMouseButtonUp(0) || Input.GetMouseButtonUp(1))
        {
            dragEnabled = false;
        }
    }
    void OnMouseDrag()
    {
        if (dragEnabled)
        {
            Vector3 worldDragTo = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, dragStartDistance));
            transform.position = new Vector3(worldDragTo.x, dragStartPosition.y, dragStartPosition.z);
        }
    }
}

I basically want to set limits to how far my object can be dragged.

You can just make an editor script to do that. Just throw this on any GameObject and fill in the limits

using UnityEngine;
using System.Collections;

[ExecuteInEditMode]
public class ClampPosition : MonoBehaviour
{
	public Vector2 xValues;
	void Update()
	{
		if (transform.position.x > xValues.y)
			transform.position = new Vector3 (xValues.y, transform.position.y, transform.position.z);
		else if (transform.position.x < xValues.x)
			transform.position = new Vector3 (xValues.x, transform.position.y, transform.position.z);
	}
}