How do you calculate how long an iPad is supported? Is this similar to Android?

I am an Android user and I am looking into iPads.

In Android knowing till when Google supports security/software upgrades is important when making a decision on what phone to buy.

Is this relevant for Apple too? I was Googling and it seems that it is expected that one can keep an iPad at best case for around 5 years but I don’t understand exactly what that means?

E.g. if I look at a 2022 model does that mean that Apple will support security/software updates till 2027? Or that a 2022 model if I buy it today it will last me for 5 years? I.e. usable until 2029?