Not many footballers are able to stay at their best level at that age and that is not just talking about goalkeepers but almost all.
However for players in the goalkeeper position it is much easier to adapt at a slightly older age because they do not need speed but instinct.
That is why there are some goalkeepers who manage to perform consistently until that age, but teams also try to get a much younger goalkeeper for the long term.
Young goalkeepers are not experienced in playing tough games so they need experience to reach the best level and that is why they are loaned out to other teams before they come into the first team.
This made me remember Buffon of Juventus, he was up to 40 years and was still the first choice of the team even if they still had younger goalkeeper to keep for them, they wanted an experienced goalkeeper and that was why he was their first choice until he left the club. Experience is most important for every goalkeeper and what we saw when teams still make use of their old goalkeeper in top matches such as league matches and champions league matches was because they know the most experienced goalkeeper will do more justice to them than a younger or new one that just joined the team. Goalkeepers can spend longer time playing than normal players, so they’re at advantage of winning even more trophies than players, that is if they play in a more qualitative team.