# I have given the Levites as a gift to Aaron and his sons
Yahweh appointing the Levites to help Aaron and his sons is spoken of as if they were a gift that Yahweh were giving to Aaron and his sons.
# I have taken them ... I have given them
Here "them" refers to the Levites.
# when they come near
Here "they" refers to the people of Israel.