Note: This answer was written under the assumption that the question was "When will MD5 specifically not be useful anymore?". For an answer about when hashing algorithms in general will not be useful anymore, please see mti2935's answer.
MD5 is already not useful for passwords.
MD5 was never made to be used to store passwords. That was never its intended purpose, it was just misappropriated for it. Imagine a carpenter driving a nail into a wood by hitting it with the grip of a screwdriver - it works, but it has some disadvantages that could be alleviated by the use of correct tools.
What flaws does MD5 have?
MD5 was originally designed to be a message-digest function, but it has since been demonstrated numerous times that MD5 is not fit for that purpose. Back in 1996, attacks on MD5 have been described. 2004 researchers Xiaoyun Wang & Hongbo Yu demonstrated that MD5 is not collision-resistant, and shortly after an improved attack was described. As the years passed, more and more flaws were found in MD5.
The Wikipedia article goes in-depth on the other security flaws, in case you wish to go down the rabbit hole yourself.
What can MD5 be used for still?
MD5 can still be used as a checksum if you want to ensure that data has not been accidentally modified (e.g. by a transmission error). So calculating a checksum locally, then uploading a file and then calculating a checksum remotely and comparing the two is certainly still a valid application for MD5. Should it be used? Eh...probably not. SHA-1 is faster by a little bit in my testing (MD5 took 2750 ms to hash an 1 GiB file, and SHA-1 took 2550 ms). But if you are on a system where only MD5 is available, don't feel bad for using it to check if two files are the same - as long as you don't expect an attacker to have manipulated them.
Then what should you use to store passwords?
The appropriate tool for the job is a tool that was designed for the job. Just like how you don't hammer in a nail with a screwdriver and don't drive a screw with a hammer, you don't store password hashes using something not made to store password hashes.
In this case, OWASP recommends the following algorithms as by 2020:
I recall scrypt used to be on that list, but I don't know why it has been removed. What these algorithms have in common is that they have a variable work-factor. That means you as the server owner can define how much work needs to be put in for passwords. This means crackers will get magnitudes worse performance, which makes cracking your hashes a lot less desirable.