You ask a tough question to which nobody can provide a definitive answer. In considering a used iPad, you will very likely be purchasing a model that is already part-way through its support lifetime.
While Apple never pre-announces end of support, history demonstrates that most model of iPad receive update support for around five years - and in some cases, perhaps one or two more years beyond this. All current models of iPad support iPadOS 18.x, but some models may already be one two years from their initial release.
Many third-party App Developers will only support the current and prior one or two prior major versions of iOS/iPadOS.
For information, here is a list of the highest version of iOS supported by the older models of iPad (for simplicity - “generations” are shortened to a number) that are restricted in their ability to be updated:
32-bit devices (obsolete)
iPad1 - iOS 5.1.1
iPad2, iPad3 and iPad mini1 - iOS 9.3.5 (WiFi Only models), iOS 9.3.6 (WiFi+Cellular)
iPad4 - iOS 10.3.3 (WiFi Only), iOS 10.3.4 (WiFi+Cellular)
64-bit devices
iPad Air1*, iPad mini2 and iPad mini3* - iOS 12.5.7
iPad Air2, iPad mini4 - iPadOS 15.8.3
iPad5, iPad Pro (9.7"/12.9" 1st generation)* - iPadOS 16.7.10
iPad6, iPad Pro (10.5"/12.9" 2nd generation) - iPadOS 17.7.5
(*) obsolete
Newer models are all able to be updated to the current version - iPadOS 18.3.1
- iPad Pro 13" (M4)
- iPad Pro 12.9" (3rd generation and later)
- iPad Pro 11" (1st generation and later + M4)
- iPad Air (3rd generation and later + M2)
- iPad (7th generation and later)
- iPad mini (5th generation and later + A17 Pro)
Given the above insight and your stated criteria, you would be ill-advised to consider anything other than an iPad capable of running iPadOS 18.x - accepting that anything other than a current model iPad is unlikely to meet your objective of full support for five-years or more.
Current iPad models:
- iPads Pro M4
- iPads Air M2
- iPad mini (A17 Pro)
- iPad 10