I can't recall the name of the rhetorical scheme or literary device involved with using the same word more than once within the same sentence but with different meanings:
"The only thing we have to fear is fear itself."
- fear – verb
- fear – noun
"Turn right right here."
- right – adv. directional
- right – adv. in this place
"My feet are but feet away."
- feet – noun lower appendage
- feet – noun distance
Best Answer
Perhaps you mean antanaclasis:
From Silva Rhetoricae, "antanaclasis".
Some examples from that site:
(op. cit.)
The overarching figure for such repetition in brief sentences is paregmenon:
Polyptoton (as in your first example), is also a possibility:
Adnominatio is sometimes used as a synonym of polyptoton.
Antistasis,
is sometimes used as a synonym of antanaclasis.
(All definitions from Silva Rhetoricae.)