It will depend on the reason for terminating your contract. If the employer has already indicated that he is considering redundancy, then it would be hard (but not impossible) for him to suddenly change his mind and say that your contract was terminated due to incapacity. That's not to say that an unscrupulous employer would not try something like this if he knew that you were considering an application for an Invalidity or Disability payment!!!
Once you have been on lay off for 4 weeks, you can apply for voluntary redundancy (without payment for notice). If your employer accepts that, then you'll get your payment. However, the employer has the option of making a counter-offer of 13 weeks work, and if he does so the voluntary redundancy application is nullified. If you found yourself in that situation and were unable to return to work due to incapacity, you could find your contract terminated for incapacity. You could of course contest this through the Employment Appeals System as you would suspect that the real reason for termination was the original redundancy, but you would be on much more difficult ground given that the employer had offered you the 13 weeks!!!
Once your employer has confirmed that he is making you redundant by giving you the RP50 form, or failing to reply to issue a counter notice to any application for voluntary redundancy, then you are fine as this essentially confirms that the reason for termination was redundancy rather than anything else.
Of course, once you apply for Invalidity Pension, you will no longer be eligible for Jobseekers. You can however apply to the Community Welfare Officer for a payment pending your application (although this is of course means tested).
You may also have difficulties with any Invalidity application given the timing of your application. There will be an in-built suspicion that you are only applying for this because you lost your job and you will face additional scrutiny in the application process.
There are 2 possible medical routes to Invalidity Pension.
The first is "Incapacity for work of such a nature that the likelihood is that the claimant will be incapable of work for life".
The second is "an incapacity which has existed for 12 months prior to the date of claim, and where the Deciding Officer or an Appeals Officer is satisfied that the claimant is likely to be unable to work for 1 year from the date of claim. "
Obviously the second one is much easier to fulfill, so you really should consider going on Illness Benefit for a year or so first, although its not mandatory.