If you cannot sign the will due to a physical incapacity, then it can also be signed on your behalf by another person who “stands in” as you. You must be in the in the room at the same time it is signed at your direction. However, you must have the mental capacity to make the will, otherwise the will is invalid. Any will that is signed on your behalf must contain a clause saying you understood the contents of the will before it was signed.
If you have a serious illness or a diagnosis of dementia, you can still make a will, but you need to have the mental capacity to make sure it is valid. It may be worth obtaining a medical practitioner’s statement at the time the will is signed, certifying that you understand what you are signing. This can then be presented if the will is ever challenged later down the line.