[subject] + [verb] + 在 + [place]
[subject] + [verb] + 到 + [place]
After certain verbs, 在 + a place says where someone or something ends up and stays: where they live, sit or stand, where a thing is put or written. The 在 phrase comes straight after the verb.
The verbs that take it are mostly about position: 住, 坐, 站, 躺, 放, 写, 停, 挂.
在 + place before the verb says where an action takes place. After the verb, it says where the result lands.
With 住 both orders are fine: 我在北京住 and 我住在北京 mean the same.
到 after a verb of movement gives the end point: "to", "back to", "as far as".
Nothing goes between the verb and 在 or 到. 了 moves to the end of the sentence.
An object can't sit between them either. It moves to the front, often with 把, which has its own point.