how to not make both objects collide at once

I have a game where i want to make if i place the 1st object on the second object it goes back to it’s original place, but whenever i try to place it on the second object they both go back to their old places
here is the 1st object code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerUndoer : MonoBehaviour
{
    public GameObject GO;


    void OnCollisionEnter(Collision collision)
    {
        if (collision.collider.tag == "Bounce")
        {
            GO.transform.position = new Vector3(-5.8f, -3.85f, 0);
        }
    }
}

here’s the 2nd object code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerUndoer2 : MonoBehaviour
{
    public GameObject GO2;

    void OnCollisionEnter(Collision collision)
    {
        if (collision.collider.tag == "Bounce")
        {
            GO2.transform.position = new Vector3(-4, -3.85f, 0);
        }
    }
}

It looks like you just need to add a bool to switch who’s turn it is.

On a script, have a public bool named Turn (or anything you want really).

On one of the scripts, only run the collider check if it’s true, the other script only check if it’s false.

Then have an event change Turn true/false depending on how you are determining which piece takes precedence.