I submitted a paper and it is currently under review (submitted on 10th March and conference is on 15th October, I'll be notified on 15th July). However, now, in May, I see a paper has just published dealing with the same problem as mine. They indicate that their solution is better than mine. If my paper is accepted, do I have to withdraw it, as it seems to be out of date?
It's a slightly grey area but assuming the journal paper in question was not publicly available before the submission date of your conference, I think you are fully entitled to publish the paper if accepted. It's a parallel result, which means there was (verifiably) no wrong-doing on your part. If accepted, in the "camera-ready" submission, you can add reference to the journal paper with a note that their results were developed in parallel (with mentions of the dates involved in a footnote, for example). You get your publication, the authors of the work get their citation, and the conference themselves know that there was no wrong-doing involved.
So again, you don't have to withdraw, but you can if you want (e.g., if you don't want to be associated with a weaker form of the result, or if you are a really nice person and feel that the slot at the conference might be better used elsewhere).
If you did not know about the other paper and it was not available at the time you were doing the research for your paper, your paper is considered as an independent research. Moreover, if your approach to the problem is different, it will partially justify the importance of your work.
However, it is important to send an email to the editor and explain the situation to him/her. It may cause the rejection of your paper, but it is your obligation to let the editor and the referee of the paper know about the parallel recent works.
A similar situation has happened for one of my papers recently. After explaining the situation to the editor, he considered the paper to be an original research work.