These two verses do sound contradictory on the surface, if they are taken out of context. But if we look at the context, we will quickly realise that they are not. Verse 2 in context reads:
Brethren, if a man be overtaken in a fault, ye which are spiritual, restore such an one in the spirit of meekness; considering thyself, lest thou also be tempted. Bear ye one another’s burdens, and so fulfil the law of Christ (v. 1-2).
When we read these two verses together, we see immediately that the apostle has in mind how Christians should exercise love one towards another as brothers and sisters in Christ. What is the "law of Christ"? I have no doubt the apostle is referring to what the Lord taught his disciples:
"A new commandment I give unto you, That ye love one another; as I have loved you, that ye also love one another. By this shall all men know that ye are my disciples, if ye have love one to another" (Jn 13:34-35).
And love for one another may be exercised in many ways. Paul speaks of one of the most important ways here, which is that we must share one another’s burdens. If a brother is overtaken by an obvious fault, he has a burden. If he is not bogged down by a sense of guilt, then he is in bondage to his sin. Either way, his brethren should not shun him (see v. 3) nor leave him to struggle alone. He needs help. His brethren who are more spiritual can help by admonishing and counselling him (cf. Rom 15:14) and leading him back to the Lord and the joy of salvation.
Of course, we should also bear one another’s burdens in other ways. For example, "Forbearing one another, and forgiving one another" (Col 3:13a); and providing material helps to those in need (1 Jn 3:17).
Verse 5, on the other hand, reads in context:
4 But let every man prove his own work, and then shall he have rejoicing in himself alone, and not in another. 5 For every man shall bear his own burden. 6 Let him that is taught in the word communicate unto him that teacheth in all good things (v. 4-5).
Read in context, it is clear that Paul has in mind the individual’s personal responsibility to labour for his own daily bread. Although brethren in Christ may bear one another’s burden by providing temporary material helps to those in need, it is a biblical principle that every believer should ordinarily work hard to earn his own subsistence, as well as to share with others who are unable to do so. Elsewhere the apostle Paul says: "if any would not work, neither should he eat" (2 Thes 3:10); and "Let him that stole steal no more: but rather let him labour, working with his hands the thing which is good, that he may have to give to him that needeth" (Eph 4:28). In Galatians 6:5, Paul speaks not so much of giving to those in need, as sharing with those who teaches or preaches the Gospel, for "the Lord [hath] ordained that they which preach the gospel should live of the gospel" (1Cor 9:14).
"Bear ye one another’s burdens" (v. 2) and "Every man shall bear his own burden" (v. 5) are therefore not contradictory, but complementary principles. We must share one another’s burdens as brothers and sisters in Christ, and yet we must strive not to be a burden to our brothers and sisters in Christ. Instead, we must strive to bear our own burden, and to become one who is able to share with our brethren in Christ.