How to detect and change things on the object that it collided with

Godot Version

func _process(delta):
	for ray in Raycasts:
		if ray.is_colliding(is_in_group("Slime")):


So, I am making like a lava ball that you can shoot. Is there a way of knowing if the “Enemy” got hit by it? I tried with groups but that didn’t work. And is there a way to then queue_free() the enemy too?

what the lava ball node type is?
if it’s CharacterBody2D, you can either use move_and_slide or move_and_collide
if move_and_slide you will need to check collision who it collides it by get_slide_collision
if move_and_collide, you just hear its return value and check if it’s enemy

if it’s RigidBody2D, use the body_entered signal it emits