Lightyear, which will be released in theatres next month, tells the origin story of Buzz Lightyear, the hero of the original Toy Story franchise, the first installment of which was released in 1995.
Leclerc and Sainz were brought in as voice actors for the movie, lending their voices to the same character in the Italian and Spanish language version respectively. Which character the two Ferrari F1 drivers are portraying is being kept a secret for now.
On Wednesday images were revealed of both Leclerc and Sainz taking to the Pixar studios to voice their role.
"It was my first voice acting cameo," Leclerc said. "It was a completely different experience from what I have done in the past. It was a bit strange and much harder than I thought.
"It was a great experience, and I can't want to see the final result."
Leclerc and Sainz are not the first F1 drivers to voice animated roles. Lewis Hamilton and Sebastian Vettel worked on the Cars franchise, also voicing the same character in Cars 2 and Cars 3 in their native languages.
Cars 2 also featured voice acting by the likes of Fernando Alonso, Jacques Villeneuve and Vitaly Petrov. Cars 3 leaned more heavily on NASCAR stars including Jeff Gordon, Richard Petty and Chase Elliot.
Both Lightyear and Cars are produced by the legendary animation studio Pixar and released by its parent company Disney.
Lightyear is set to be the fifth film in the Top Story universe, and a prequel to the four instalments of the main Toy Story series.
Upon its 1995 release Toy Story became a smashing success. The two most recent instalments, Toy Story 3 and 4, grossed over a billion USD worldwide.
Lightyear is set to be released around the world between 15 and 17 June. Ferrari fans can admire Leclerc's work from 15 June in Italy, with Sainz featuring in the Spanish release version from 17 June.
The timing of the Ferrari driver's cameos coincides with the iconic Italian team's most successful F1 season in years, with Leclerc taking two wins and three further podiums in 2022's first six grands prix.