How are a toe hematoma and a toe melanoma different?

Distinctly different. A hematoma is an accumulation of blood usually after an injury that clears up with time. A melanoma is an area of dark pigmentation or no pigment (amelanotic melanoma) which is cancerous.
Totally different. A hematoma is a collection of blood. A melanoma is a skin cancer that needs to be addressed quickly to keep from spreading.