"He stands next to me" means there is no one in between him and me. "He stands near me" means he stands close to me, but there could be someone in between. By means near; at the side of; close to. "He stands by me". In the song, "stand by me" means stand at my side.