The organisms which excrete nitrogen in the form of ammonia are termed ammonotelic organisms.
Examples: Protozoans, Crustaceans, Platyhelminthes, fishes, tadpoles, etc.
Ureotelic organisms
The organisms which excrete nitrogenous wastes in the form of urea are termed ureotelic organisms.
Examples: Adult amphibians, mammals, cartilaginous fishes, etc.
Earthworm:
They belong to the Annelida phylum, which is like a tube-within-a-tube body plan.
Earthworms have nephridia, an excretory organ, that helps in the removal of wastes in the form of ammonia when an excess of water is available. When on land, they excrete wastes in the form of urea.
Earthworms are both ammonotelic, in water, and ureotelic, on land.