WaitForSeconds isnt working

Hey, I tried to use WaitForSeconds in my script, but its not working and i cant figure out whats the reason. Without the WaitForSeconds line in the coroutine everything is working fine. But as soon as i try to add this line its not working anymore.

public class Collision : MonoBehaviour
{
    public GameObject gameover;
    public GameObject explosion;

    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.tag == "Pylon")
        {
            Destroy(other.gameObject);
            explosion.SetActive(true);
            StartCoroutine(delay());
            GameObject.FindGameObjectWithTag("Player").SetActive(false);
        }
    }

   private IEnumerator delay()
   {
        yield return new WaitForSeconds(3);
        gameover.SetActive(true);
        Debug.Log("Game Over");
        yield break;
   }
}

Hellium’s comment is most likely the answer. If your Collision script (the script shown) is on the Player’s gameobject, it is being disabled and not continuing.
These two lines:
StartCoroutine(delay());
GameObject.FindGameObjectWithTag(“Player”).SetActive(false);

The coroutine will stop at your waitforseconds, and the next line executed is disabling the player gameobject, so if your Collision script is on the player, the coroutine is stopped because inactive gameobject do not run coroutines (they die as soon as gameobject becomes inactive)

If you want to get around the problem you can simply use Invoke(“YourFunction”, 3); and make a function to be called instead of using a coroutine.