You can have both Cobra and Medicare but it does not make financial sense unless your employer is paying the premium for your Cobra coverage. When you you are 65 or older and you loose your job and offered Cobra you must sign up for Medicare Part A and Part B. Medicare will be your primary coverage and Cobra will be secondary. If your employer is not going to pay the premium for your Cobra coverage you would save money by getting a Medicare Supplement instead of paying for Cobra.
If you qualify for Medicare your Part A coverage is normally "free". You paid for it in advance during your working years.
Part B requires a premiuim.
In most cases Medicare will pay first, COBRA second.