Convert dict entries to sets and lists
Instead of appending the id's one by one, I would use:

ids = list(people.keys())


Note that I changed names to ids, as numbers don't seem like names to me. This is something that @jano's answer included but didn't explicitly state. 

Then you can change your the rest of your code to:

first_names = set()
last_names = set()

for details in people.values():
     first_names.add(details['first'])
     last_names.add(details['last'])