1 Peter 4:5-6

Ceasing from sin: V.5. They shall give account to Him that is ready to judge the quick and the dead. V.6. For for this cause was the Gospel preached also to them that are dead, that they might be judged according to men in the flesh, but live according to God in the spirit.

The apostle wants the Christians not to be intimidated or otherwise influenced by the attitude of the unbelievers: They shall have to give an account to Him who is ready to judge the living and the dead.

A time is coming, and that very soon, when the unbelievers will think of their blasphemous behavior with a regret which will be too late. For the Lord is prepared even now to return for the judging of the living and the dead, for the final Judgment; and from His sentence there will be no appeal.

These heathen who now abuse the Christians will then have to answer for their hatred and persecution of the Christians, and since they cannot give an account that will satisfy the holiness and justice of God, their portion will be that of eternal damnation. This fact is a consolation to all believers that are subjected to such maledictions more or less.

For the same reason the apostle adds: For to this end was the Gospel preached also to them that are (now) dead, that they might be judged in the flesh indeed after the manner of men, but might live in the spirit after the manner of God. This statement has no connection with the fact given in chap. 3, 19, but belongs into this connection. To certain people that are now dead the Gospel was preached during their life, they became partakers of its wonderful blessings, in order that they, although subject to the general curse of death according to their mortal body, yet might live in the spirit, so far as their soul was concerned, and that after the manner of God, that is, in a spiritual, divine, glorified existence, until the day when God would reunite their bodies with their souls.

Thus the purpose of the preaching of the Gospel was realized in the case of those that died in the Lord. The connection of thought, then, is this: While death does not remove the blasphemer from the final Judgment and condemnation, it confirms the hope of the Christians that their souls, which are safe in the hands of God, will be reunited with their bodies on the last day and enjoy everlasting salvation and glory in the presence of God.