It looks like this code expects the audio source to be in two different places:
GetComponent<AudioSource> says the audio source is on "this" object, the one that just collided with something.
effect.transform.parent = null and
Destroy(gameObject) seem to assume the audio source is on a child game object, which can "eject" to safety before the parent object is destroyed.
These two assumptions aren't compatible. Either the source is actually on a child object and the first line returns
null, or the source is on "this" game object and it goes down with the ship, getting destroyed this frame. Both possibilities lead to no sound being played.
To know how to fix it, we'll need to see a bit more about how your scene is set up.
You can also consider using the static method AudioSource.PlayClipAtPoint() to fire a "posthumous" sound without manually managing another game object.