It wasn't shown on the live broadcast, but a moment for Daniel Ricciardo during the Virtual Safety Car explains why he ended up so far behind his teammate
Danny-Ric had a moment in the early laps at Turn 9 which dropped him a bit behind Max Verstappen, but he soon caught up and was suggesting to his team that he was faster.
Indeed, throughout the race Ricciardo was very quick and pumping in multiple fastest laps, yet somehow ended up well over 20 seconds behind the battle for third between his teammate and Sebastian Vettel. How? Well, this explains it - at around the time Max was nudging Lance Stroll as the VSC ended, Ricciardo did a bit of a Grosjean and got a bit happy with the throttle pedal.
How that wasn’t brought up during the race we don’t know as it was probably one of the most dramatic moments of the grand prix. Still, it probably didn’t cost him much considering how difficult it is to pass in Barcelona and at least gave him the clear air needed to set the fastest lap!