It depends really on your target audience and of you know the spread of devices they have.
Then you can look at boundaries, in terms of smallest and largest screen, oldest and newest version of OS. Also if it’s browser, versions of they also.
I couldn’t hope to maintain a device farm large enough to properly cover theses boundaries, this is where a service like BrowserStack, Sauce Labs or Amazon Device Farm comes in.
But it comes down to what risks you are mitigating and what behaviour you are validating.
If you need a device your hands, you are going to need to accept you can’t test a large range of devices. Don’t nobody got time for that.
If you don’t have specific data for your customers, you can use general analysis like StatCounter