How do I use Raycasting to return gameobject

I need a ray to hit a gameobject, and deal damage or destroy gameobject.

This is what I have:

if(Physics.Raycast(myRay, out hit)){

I get UnityEngine.RaycastHit returned from debug, how to take this info and use it?

The Unity Learn tutorial Survival Shooter found here does exactly this and may be helpful to you. Their code calls an EnemyHealth script on the enemy, which receives the damage and reduces hit points and destroys the enemy if necessary.

        if(Physics.Raycast (shootRay, out shootHit, range, shootableMask))
            EnemyHealth enemyHealth = shootHit.collider.GetComponent <EnemyHealth> ();
            if(enemyHealth != null)
                enemyHealth.TakeDamage (damagePerShot, shootHit.point);

you can use hit.transform.gameObject or hit.collider.gameObject