how to get bullets to collide with objects but not themselves

does anyone know how i could get my bullets to collide with the world and enemies but not with eachother?

You can assign a layer specifically for bullets and then in Edit → Project Settings ->Physics you can turn off collision between objects on that layer via the layer collision matrix. Here is Unity documentation explaining how this is done.

maybe u can use this

its depend on ur layer
its recommend u put gameobject in layer first

   private void OnCollisionEnter2D(Collision2D collision)
    {
        //in my script, my player is layer 10, and player projectile is 11, so player projectile cant hit player 
        Physics2D.IgnoreLayerCollision(10, 11);
     }