@vaporeon_ both mammoths and mastodons are genuses, meaning they contain several distinct species. both genuses are in the same order, so they are distant relatives which accounts for some of their similarities (similar ecological niches also does a lot towards making them similar, they split off from eachother genetically at least 25 million years ago).
mammoths are closely related to the extant asian elephants (more closely so than asian elephants are with african elephants) but are distinguished from them by having large spiraling tusks and (on most species) cold adapted fur. the various mammoths ranged in size from modern elephant size to considerably larger.
mastodons are all decently closely related to each-other but not to anything else, living or extinct. the characteristic which first tipped us off that they were distinct from elephants & mammoths is that their teeth look like pairs of cones — mastodon literally means “boob teeth” (image from https://www.uky.edu/KGS/fossils/fossil-month-11-2021-mastodon-teeth.php )