check if two colliders Rub against each other

I have 2 box colliders which can undergo and detect collisions when the cubes attached to them do so .Now i need to detect whether the cube are rubbing against each other for some time and not just colliding .please help .(see the pic).

You can do that by using OnCollisionStay(Collision).

OnCollisionStay is called once per frame for every collider/rigidbody that is touching rigidbody/collider.

So you can set a timer in this and do your stuff.

For more refer