Using someone for a specific purpose and then discarding them right afterwards
There are many colorful and informal words for such a person(!), but one that I think would make it into formal speech would be a "user"—which has a negative sense of someone who exploits people for their own ends and then discards them, as it were. It's sometimes lengthened to "user and abuser".
In recent popular lore, there's a "wombat"—one who "eats, roots and leaves" … based on the Australian animal that supposedly "eats roots and leaves".
Online, there are also "vampires", as in "help vampires", who suck the blood out of others by endlessly asking for help but rarely, if ever, returning the favor or saying thank you.
Consider, leech.
: a person who stays around other people and uses them for personal gain M-W
: someone who calls themselves a friend but they only use you until someone better comes along to feed off. Jasper was such a leech, he would use people for there drugs, money and sex than move onto the next victim to suck dry. Urban Dictionary