How do you stop objects from floating into space?

I have 2 objects and a plane. I want to raise these objects without falling so when I start to raise one of the two I deactivate its gravity only of that body but if it collides with the other body it begins to float in space. I already verified and it’s not my plan falling. Any suggestions?

 float jump = Input.GetAxis("Jump");
 position.y += jump * speed * Time.deltaTime;
 if (Input.GetKey(KeyCode.Space))
                        this.gameObject.GetComponent<Rigidbody>().useGravity = false;

It’s just reacting appropriately to a collision. If you don’t want it to react to collisions set the rigidbody to kinematic. You can set it in code as well.