Give Custom Item and clear it when finished

Basically it's a datapack that gives a player a certain item to use, then with another function clear it from the other players inventory when done, How Would you do it?

Continue to help post