Should I disclose to the editor that I am reviewing a similar paper by different authors for a different journal? About a year ago I received a request to review a paper from author X in journal A. The paper uses a hype tool T to solve a common problem, which is good, but due to some shortcomings in the implementation I recommended to revise the manuscript. The editor followed my recommendation.

About a month ago I was contacted by an editor in journal B asking me to review a manuscript from unrelated authors Y. They use the same hype tool T to solve the same problem. I accepted to review it, and mentioned that I had reviewed a similar paper for a different journal (without naming it). It is now due in a couple of days.

Now to my surprise I just received a request to review a revised manuscript of author X from journal A (I thought X had given up on it since more than a year passed). I would like to accept but won't be able to deliver the review before 3-4 weeks.

This is a "winner gets it all" kind of situation. The paper that gets  published first wins, and I think would be ground to drop and reject the second paper as not really novel any longer. (No plagiarism here, and nothing unethical done by the authors; just an obvious answer to an old question with hype tool T. I had myself thought of it before hearing from A, and discarded it only due to lack of time.) How should I deal with that?

Should I disclose to the respective editors that I am reviewing similar papers? I suspect that would be a breach of the confidentiality. Should I have refrained to mention to editor of journal B that I had reviewed a similar paper in the past?

Would it be a conflict of interest to review the revised manuscript from X? Should I decline the review? 

Also, should I inform the editor of the other journal once the first paper gets published? If so, how can I politely ask to be informed when the manuscript gets published without giving away that there is a similar manuscript out there?
Simultaneous or independent discoveries happen often. If the paper A has a first submission date published, that should ensure paper A being fairly treated. 

Apart from that, I do agree with the other responses that actually discussing the situation with the editors (without disclosing mutually the authors) may be a good idea here. 

My purely personal view (others may disagree) would be that independent results which overlap temporally due to an unlucky accident both deserve publication. It was pure coincidence that in your case they ended up going via a single-person bottleneck.