Khan and Dutt, both close friends, have been in the industry for more than 25 years. The actors, however, have also courted controversies.
Asked what has he imbibed from their lives as an actor and as a person, Kapoor says he learnt the ability to be real, come what may.
"With Salman sir and Sanju sir, who are such loved superstars, it is very important to be who you are, irrespective of doing anything right or wrong. They are two actors who really are who they are. They probably made mistakes in their lives and probably paid a price for it.
"But you know who they are as people and I think that's what is important. You cannot manipulate an audience, you cannot live a PR filled life or try to be someone you're not, give impression to people 'Oh, I am so great'. You just have to be who you are," Kapoor told PTI in an interview.
The "Jagga Jasoos" actor believes that in the end the audience wants to be entertained by movies and as an actor, all he wants is people to like him for his work, which is of utmost importance.
But being real in front of the audience for actors can be tricky and Kapoor feels it is "way more difficult to be emotionally naked than physically."
The chance to be emotionally vulnerable came to him with Rajkumar Hirani's "Sanju", a biopic on Dutt.
"'Sanju' was such a part where I got so much opportunity. It had so much in the part, as an actor you get turned on and say 'wow'. It is hard, but sometimes you have a cushioned pillow in the form of a filmmaker, Rajkumar Hirani.
ALSO - Rumored couple Alia Bhatt & Ranbir Kapoor visit real ‘Sanju’ Sanjay Dutt’s house together!
"You feel comforted, there is so much trust, you want to surrender and be honest to the moment completely," he says.
When the script -- written by Hirani and Abhijat Joshi -- came to him, every aspect of Dutt's life shocked him.
"The Sanjay Dutt you and I know is very different from what you will see in the film. Someone who is scared, made mistakes, who you'd probably think is immature, selfish. To understand him from this perspective was new, endearing and exciting.
"You may have your own opinion about him after you see the film, but it is an honest portrayal of a very troubled man who has made a lot of mistakes," Kapoor says.
"Sanju", which features actor Paresh Rawal as Sunil Dutt, is the story of the ups and downs in the life of the "Munnabhai" star and focuses on the relationship between him and his father.
For Kapoor, the father-son dynamic hit closer home.
"I really identified with that dynamic between Sanju sir and Sunil sir, because me and my father have a similar relationship.
There is a lot of fear, distance, admiration, respect and love. We both are actors.
"The three backbones of 'Sanju' are the father-son dynamic, the friendship dynamic and a question mark," he says.
"Sanju" is slated to release on June 29.