It's where you are physically living that counts for benefits. A two-part quailfication if you like.
Being liable to pay rent on a places does not entitle you to benefits for that rent unless you are also living there.
(In the case of UC that means where you are living at the end of your AP).