Spherecasting in 2D environment

I’ve always used spherecasts for 3d environments but they dont seem to work in the new 2D environment. I’ve seen some examples of the new 2D spherecasting but can’t get it to work. Here’s my current code for my 3D spherecasting.

      var hitColliders = Physics.OverlapSphere(this.transform.position, 10);
        
      for (var i = 0; i < hitColliders.Length; i++) {
        	if(hitColliders*.gameObject.tag == "enemy") {*

_ hitColliders*.SendMessage(“test”);_
_
}_
_
}*_

Physics functions are not compatible with Physics2D functions. Try to use Physics2D.OverlapCircleAll instead of Physics.OverlapSphere.

Check this 1 for more information.