Sanji is a foil to Donquixote Doflamingo. To wit:
Both came from wealthy backgrounds, with Doffy being a former World Noble and Sanji being the third son of the Vinsmoke family, a royal family of Underworld assassins and commanders of Germa 66 whose power and affluence are almost on par with the World Nobles.
Both left their cushy lifestyles at a young age, but Sanji did it willingly because his relatives are criminal assassins and because said relatives (save for Reiju and Sanji's deceased mother) were abusive assholes. Meanwhile, Doffy had to discard his title as a World Noble because his father wanted him to learn how to live among the commoners their neighbors so often mistreated, which Doffy never quite got over even as an adult and has been trying to be accepted back into Mariejois ever since.
Both are very formidable fighters, but Sanji is a physical fighter whose kicks are aided by Haki. Meanwhile, Doffy is a Devil Fruit user who, while no slouch in direct combat himself, tends to heavily rely on his powers.
Both have a talent at being The Chessmaster, but Sanji uses his talents to help people, while Doffy's entire career lies in using people like puppets (literally and figuratively) and even caused an entire kingdom to suffer for it.
Both Sanji and Doffy hate their fathers, but Sanji has a legitimate reason because Vinsmoke Judge is a brutish man and abusive parent who believes in Might Makes Right and conquered the North Blue just to demonstrate his family's strength and power. Meanwhile, Doffy's father was kind and well-meaning, but his idea of making his family leave the World Nobles to live among the commoners made Doffy lash out like a brat who was denied his allowance and kill him (though it's implied the death of Doffy's mother, as well as his father's naivete, provided motivation as well).
Both have antagonistic relationships with their siblings. Sanji's older and younger fraternal quadruplet brothers are assholes who bullied him for being a weak waste of space. Doffy's brother Rocinante opposed him because he believed his sibling was "evil to the core".
Finally, Sanji and Doffy's personalities are basically inversions of each other. Sanji is a Jerk with a Heart of Gold who genuinely loves his friends no matter how much he argues with them, and is a compassionate, Princely Young Man underneath his abrasive, harsh exterior. Meanwhile, Doffy's kindness, charisma, and father-like treatment of his pirate crew hides the insane, entitled, sadistic, prideful scumbag who psychologically manipulates his "family" into serving as his tools and won't hesitate to discard them when it's convenient.