How do I delete the parent of the object I'm currently in?

I have a Ball object with physics applied to it, and it has a sub gameObject (Pickup) with a spherical trigger on it so that you can pick it up when you walk near by.

How do I delete the parent object?

var deleteObj = (gameObject.name != "Pickup") ? gameObject : transform.parent;
Destroy(deleteObj);

I’m getting this error because it’s not a game object. How do I get from the transform to the game object?
“Can’t remove component.
Can’t remove Transform because MeshFilter, SphereCollider, MeshRenderer, Rigidbody depends on it”

Use transform.parent.gameObject;
instead of

transform.parent;

That worked, thanks.