It is the Goldilocks Zone for life theft because of multiple contributing factors. Each one is not the singular defining factor, but have their own ideal age ranges of effectiveness. But by putting all the factors together, it winds up that the age range of 25 to 49 ends up to being the best likely return on sacrificial investment.
I could see an urban fantasy situation where somebody carefully calculates various factors to try to find the ideal sacrifices for their rituals.
But for this rather dark riutal, there are a few factors to take into account, such as:
Development and Immunity
This one has been touched on already. In short, children are developing for years, and the elderly have failing bodies and processes. The ritual will work better the healthier the body is, which tends to favour those in the 25 to 49 range. They are fully developed without the potential plethora of medical issues that older folks can develop. In addition, their immune systems are likely uncompromised so they will not be likely to fall sick in the time between acquisition and sacrifice.
Fertility
The ritual steals life, but it is not just the life that is that is taken, but the lives that could be. Those potential lives are not as valuable as the lives that could have been, but a million slivers of life can add up to an appreciable amount.
Children are not fertile as a general rule. And while the human female is born with all the reproductive potential that they have, those slivers of life are not awakened until puberty. Only once the potential for them to be life is unlocked do those shards of life awaken. Likewise, the elderly have lower or no fertility, with humans being one of the few animals to go through menopause. As such, by the same logic that works for children, an elderly woman won't have those shards of life as they have gone dormant again so there is less potential to steal.
Like the previous section, while those in their teens and low twenties have that extra fertility life, it is those in this range that have a more potent fertility, though this metric does favour those in the younger side of the range.
Return and Compatibility
Logically, to steal life there must be life to steal. In theory children have the longest lifespan to take, but there are factors that limit the bruja's ability to take and harness that life.
But while we think of lifespan as a measure of the overall population, the lifespan that is stolen is tied to the victim itself and what they would have had left had they not been ritually sacrificed. Young children might have the most potential life, but they might have also been destined to die young so that there is a large gap between expected and actual returns. At the other end, elderly folks have a lesser difference in this regard but also less overall life remaining. As for the 25 to 49 demographic, they have more life to steal than the elderly and less variance in remaining time than children, making them a good balance of potential.
The second big factor in the theft is compatibility. How close is the life that the bruja is stealing to their own lifeforce. The farther from the lifeforce that the bruja had when they first undertook this dark ritual, then the more stolen life that is needed to make what is left theirs. Since this is most likely used to stave off death, the bruja is more likely to be in the upper range of the 25 to 49 age group.
Availability
Let's face it, unless there is something seriously sketchy going on, then a bruja is not going to be able to go to the local Kids Mart, and pick up a kid for their sacrifice later. Many parents are protective of their kids, and take steps to make sure they aren't kidnapped by unscrupulous casters. Likewise as people get older, many move around less and stay home more. Some will be taken care of by younger and more abled adult children, which double as protection for them. This limits a bruja's access to these age groups
While exceptions exist like beggar children on streets and older travelling monks, the above is the general case. Adults are just more available and if careful, get into accidents enough that if one disappears in the woods one day, it can be assumed that they died out there or fell victim to random chance. An travelling merchant is more likely to be taken by bandits and killed as opposed to kidnapped and sacrificed to dark rituals.
Admittedly this is not strictly a biological reason, but it does affect the readily available supply.