You can no longer claim IR ESA, that was a legacy benefit, it is now closed to new claimants.
New Style ESA is a Contribution Based benefit and is not means tested with the exception of pension income which can reduce the amount that you receive.
The Income Related benefit that goes with NS ESA is Universal Credit.
You can claim New Style ESA providing you have at least 50 weeks of NI Contributions and/or Credits in both of the Tax Years 2019-20 and 2020-21.
Gary
Nothing on this board constitutes legal advice - always consult a professional about specific problems