City moved back to the top of the Premier League with victory over their rivals as David Silva, Sergio Aguero and Ilkay Gundogan got on the scoresheet.
But a late flashpoint saw Juan Mata take issue with Sterling as he showboated in the final seconds, keeping the ball in the corner and performing stepovers as United players rushed towards him.
And while Guardiola was pleased with City's other tactics that saw Sterling, Leroy Sane and Phil Foden trade passes around their opponents, he acknowledged the England international was in the wrong.
"I like a lot the way [Sterling] played," said Guardiola, who appeared to voice his displeasure with his player on the pitch at full-time. "The best way is to keep the ball and he did it with Leroy and Phil.
"In that situation with two or three minutes left to go, they controlled it absolutely. It is better than just defending.
"But [Sterling] made some movements with the legs that we can avoid. But he's young and he is going to improve."
Manchester City (@ManCity) November 11, 2018
Sterling ended the match in a central striking position after Aguero was substituted and Guardiola was pleased with how the game plan was carried out in the second half.
"The first half was not so good, we played without the intention to attack," the coach added. "We felt a bit the pressure.
"[United] want to do well in the derby - that's normal - but we were stable, scored a goal and the first 15 minutes were so good. After that, we didn't press as well and they could play more than usual.
"After that, in the second half, we started much better, changed our press and, of course, the goal from Sergio helped us a lot.
"After we conceded it was inevitable to think about last season what happened in that situation, but we didn't concede another chance and we defended so well.
"With their free-kicks, they are so strong, more than us. But especially when Gundogan and Raheem go in the position like a striker, we had extra passes and we played so good in the last 30 minutes."