Most efficient way to do handle explosion damage?

I have a script that checks for all enemies within a given radius of a “bomb” GameObject in my game, and then applies damage to them using a foreach loop, like this:

Collider2D[] cols = Physics2D.OverlapCircleAll(transform.position, explosionRadius, mask);
            foreach(Collider2D col in cols)
            {
                if(col.gameObject.transform.root.GetComponent<Health>() != null)
                {
                    col.gameObject.transform.root.GetComponent<Health>().TakeDamage(explosionDamage);
                }
            }

When this bomb explodes on many enemies (40+) my game performance suffers a lot, as per the image below. I was wondering if there is a more efficient way of applying damage to my enemies, since I would like to have many enemies on the screen at once exploding, etc. Thank you!

first up: if you do this analys you shoud do a proper deep profile. Your assumption that all this blue line is just the foreachloop is probably not correct since it will also contain some time that is needed to do the overlap all.
Other then that it will also tell you in the “hierarchy” view which unity function was called how often and how long this needed.
Regarding this you can improve your current code by reducing the amount of made calls if you actually find and object with the “Health” component:

Collider2D[] cols = Physics2D.OverlapCircleAll(transform.position, explosionRadius, mask);
        Health health;
        foreach (Collider2D col in cols)
        {
            health = col.gameObject.transform.root.GetComponent<Health>();
            health?.TakeDamage(explosionDamage);
        }

depending on how many health objects you have in range this could cut a few milliseconds.