In situations such as the one you are describing, where there are known conflicting claimants, no insurance company wants to risk paying the wrong person, and unless the claimants can agree to something among themselves, the insurance company (once it becomes aware of conflicting claims) will routinely file what is known as an interpleader action and deposit the money with the court and allow the court to decide who is entitled to the funds.It is then off the hook. Of course, if the insurer has already paid out the money to someone not entitled to the funds, the insurer can be sued by any person who claims s/he was entitled to it.
As to whether a beneficiary designation that comes into the insurance company or pension administrator AFTER the death of the person insured or covered dies is a more complicated question, and the answer typically depends on the precise facts, including when the change was received, the wording and terms of the policy or contract itself, as well as the laws of the jurisdiction involved. Such situations are often suspicious as insurers recognize the possibility that the signature on a change of beneficiary form may have been forged, or that even if the signature is genuine, that the person signing it may have lacked mental capacity at the time s/he signed due to the illness or medicines being taken, or been the result coercion and intimidation.