As others have pointed out, there are two streams of benefits you can potentially be eligible for if you are ill or disabled.
Universal Credit (UC) is means-tested and can include a ‘not for for work’ element if you provide a GP fit note to that end, and then, in due course, are assessed at not fit for work at a medical assessment. If you have been working and paying NI for a few years then you could, instead, claim New Style ESA which is not means-tested but based on having enough NI contributions. You can usually only get this for a year, after which you would need to apply for UC if entailed.
Personal Independence Payment (PIP) is non means tested and eligibility is based on your care and mobility needs, recognising that being ill or disabled costs you money. It’s available to those in and out of work and is assessed via a (different) medical assessment.
As PPs have said you can be awarded one or both of the above. PIP tends to be the gateway benefit for other disability support, whereas UC tends to be the gateway for low income support (if that makes sense).
Basically, if you cannot work because of your ill health or disability then UC is probably what you need to be looking at applying for initially.