How to delete the exact brick which ball collided with?

Adding on to this it would seem your bricks already have a group, you do not need to get the brick node, only check the collider’s group

elif collider.is_in_group("brick"):
    dir = dir.bounce(collision.get_normal())
    collider.queue_free()

Make sure to paste code instead of screenshots