She was by my side in the building.
She was in the building by my side.
The first sentence says that she was in the building, and she was staying beside me.
The second sentence says that she was in the building that was by my side.
But the sentences below do not work like that.
3.I was there by your side.
4.I was by your side there.
Comparing the third sentence to the second sentence, I should comprehend the third sentence as saying that I was there that was by your side. And the fourth one should mean that I was by your side when I was there. But the third one means that I was by your side when I was there, and the fourth one doesn't make much sense to me. I don't even know if the fourth one is grammatically correct. Can you guys provide any explanation?