Dragging a 2D sprite with touch without going through objects

When I use this code the dragging features works fine but it ignores all the polygon colliders and simple places the sprite wherever it is being dragged. Can anyone help me with this?

private void Update()
        //Gets the world position of the mouse on the screen        
        Vector2 mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);

        //Checks whether the mouse is over the sprite
        bool overSprite = this.GetComponent<SpriteRenderer>().bounds.Contains(mousePosition);

        //If it's over the sprite
        if (overSprite)
            //If we've pressed down on the mouse (or touched on the iphone)
            if (Input.GetButton("Fire1"))
                //Set the position to the mouse position
                this.transform.position = new Vector3(Camera.main.ScreenToWorldPoint(Input.mousePosition).x,

If you want Unity to calculate your collisions properly, don’t change the transform.position manually. Use theRigidbody2D.MovePosition function: https://docs.unity3d.com/ScriptReference/Rigidbody2D.MovePosition.html.