How can i disable collision after collision?

How can i disable collision after collision? i have 2 objects with 2 box colliders and i need them to collide and then have them disable collision with each other but not with other objects?

Use Physics.IgnoreCollision