Sanji and Luffy had both mentors who made great sacrifices for them (Shanks gave up his left arm to save Luffy, and Zeff gave up his right leg for Sanji), and ultimately gave them the motivation to believe that they could achieve their dream.
Sanji understands Luffy’s personality to the point that he rarely shows shock or surprise at Luffy’s outrageous actions and decisions. In fact, he is often one of the people to assure the rest of the crew or other people that Luffy knows what he is doing. In Thriller Bark, Sanji volunteered to give his life in exchange for Luffy’s, but was stopped by Zoro. When Bege stated the crew would fall under Big Mom’s wing via Sanji marriage to Pudding, Sanji ferociously rejected the idea, saying that Luffy would never bow to anyone else. And even boldly stating like Zoro before him that “Luffy will become the Pirate King”, angering Bege.
Sanji and Luffy have a great trust in each other as seen most recently when Luffy trusted Sanji to fight off Big Mom and travel all the way to Zou while protecting Caesar, Momonosuke and the rest of the crew from all danger.
When Charlotte Cracker told Luffy that Sanji would most likely be happy with the Charlotte Family and turn away from the Straw Hats, Luffy angrily attacked him telling him not to put words in Sanji’s mouth. When Sanji actually said what Cracker said to Luffy, directly, after violently kicking Luffy off the Cat Carriage, and then telling him to begone, Luffy immediately expressed his doubt over Sanji’s words as being sincere.
Luffy then opted to not defend himself or run away when Sanji proceeded to beat him without mercy, and after being defeated, Luffy brings Sanji to tears when he expresses that he will still not turn his back on him. Luffy declared his dedication to Sanji and refused to move on without him on his journey and eating anything other then Sanji’s cooking, while at the same time declaring Sanji’s bigoted comments as forced and fake. Luffy claimed he can’t become the Pirate King without Sanji.
After getting captured and learning of Big Mom’s true plan to assassinate Sanji, Luffy became enraged and tried to rip his own arms off in order to escape and warn Sanji. After being freed by Jinbe, Luffy’s first thought was rescuing Sanji, despite his injuries and hunger, and he rushed through Big Mom’s palace searching for him.
In the same way, Sanji could not forgo his care for his captain, as when Bobbin tried to eat the Meat (meant for Luffy) from Sanji’s Bento box, Sanji became enraged and kicked down the pirate- inadvertently risking Zeff ‘s life in process.
This worth noting as Sanji almost never denies anybody food, but cared more for his starving captain than keeping his deal with the Big Mom Pirates. Sanji traveled through Sweet City and soon found his captain at the spot that he promised to meet with him which brought to his face.
Just as he did with Nami and Chopper at Punk Hazard, Luffy understood when a decision was important to Sanji, and decided to support that decision.
Sanji’s belief in Luffy was really shown as when Pudding informed him of Luffy’s battle with Charlotte Katakuri, Sanji expressed his confidence that Luffy would prevail.
When Luffy emerged from the Mirro World, Sanji fought through several of the Big Mom Pirates and carried his captain away. Sanji even suffered injuries to his own person but refused to let the vengeful enemy crew touch his captain.