I think native speakers prefer to say I lived in London for three years
Non native speakers tend to use used to when simple past serves the purpose.
I used to live in London for three years
Both the sentences mean almost the same thing and talk about the completed actions in the past and also past habits.
I here with attach a link to show how used to can be used.
https://dictionary.cambridge.org/grammar/british-grammar/used-to