tl;dr. The girl with Varys and the girl at King's landing aren't the same. The girl with Varys is trying to poison Daenerys, and the girl at King's Landing provides a perspective of Daenerys's decisions not so commonly shown.
We then see her run off and later appear at King's Landing with an older woman.
The girl at the beginning of the episode talking with Varys and the little girl with her mom at King's Landing are two different girls.
That being said, the rest of this response will address the two girls and their roles separately.
The girl who spoke to Varys
Just before the girl walks in, Varys is writing a message to an unknown person about Jon Snow's lineage and how he's the true heir to the Iron Throne.
In the most previous episode, Varys well establishes his position about the matter, with him thinking that Danaerys is too reckless and that Jon should take the throne instead. He then expressed to Tyrion that he will not betray the Realm and that he will do what he needs to at all costs. When Tyrion asks what will become of Daenarys, Varys gives him a look that implies she will die.
When the little girl walks in, she and Varys speak about someone (presumably Daenarys due to other things mentioned, such as 'her' guards always watching) not eating, and how they will try [getting Daenarys to eat] again at dinner. When Varys meets Jon Snow on the beach, he informs Jon that Daenarys hasn't been eating.
JON: How is she?
VARYS: She hasn't seen anyone since we've returned, hasn't left her chambers, hasn't accepted any food.
Game of Thrones, Season 8 Episode 5, "The Bells"
Given that Varys has expressed wanting to overthrow Daenarys in last episode, plus the conversation with the little girl, then combined with his suggestions to Jon Snow on the beach, I believe it's pretty apparent that Varys is trying to poison the Daenerys.
He tells her "The greater the risk the greater the reward." ... Do we know what Varys had in store for her?
No, we have no idea what kind of promises Varys gave the little girl. My guess though would be money and the knowledge that the little girl contributed to a better future for all of the Realm.
The little girl at King's Landing
Why would the show take so much time to show her and her perspective (?)
From "Inside the Episode" interviews with the writers, it's mentioned that the show chose to follow the little girl (among the rest of the common folk in King's Landing) because traditionally shows tend to focus on the heroes of the story and not so much the bystanders that truly suffer the consequences of the main characters' decisions.
D.B. WEISS: We wanted [Daenarys] to be just death from above as seen from the perspective of the people who are on the business end of the dragon. In most large stories like this, it seems like there's a tendency to focus on the heroic figures and not pay much attention to the people who may be suffering from the repercussions of the decisions made by those heroic people. And we really wanted to keep our perspective and our sympathies on the ground at this moment because those are the people who are really paying the price for the decisions [Daenarys] is making.
Game of Thrones, Season 8 Episode 5, "Inside the Episode"
This is also the same reason why they followed Arya, and why Arya interacted with the little girl and her mother; however, they chose Arya and not just extras because the audience is much more emotionally invested and connected with Arya (and therefore the scene is that much more compelling).
DAVID BENIOFF: The reason we decided to follow Arya out of King's Landing and to see the fall of King's Landing through her eyes is something that we talked about with an earlier episode; you just care a lot more when you're with a character that you care about. So if we saw a lot of extras running around on fire and buildings falling apart, it might have been visually interesting but it wouldn't have had as much of an emotional impact. But when you're there on the ground with Arya who's one of the people we care the most about, then everything takes on that much more of an edge.
Game of Thrones, Season 8 Episode 5, "Inside the Episode"