Creating new assignments every year does not prevent students from copying solutions from fellow students in the same semester, which imho is just as big of a problem. From my own experience this was rampant in my courses where something had to be submitted as a solution to very specific tasks.
Students would come up to you and just ask "Hey, did you already finish this task? Could you send me your solution for inspiration purposes." It is usually hard to decline this kind of request if you are friends with these people. Some really only use it as a help if they are stuck but some just change variable names and the "worst" submit a verbatim copy.
Therefore you should focus on making sure students actually solved a specific homework regardless of when it was created.
I see three possible solutions:
1. Make the content of the homework highly relevant to the exam.
I had several assignments where e.g. I would have to create a small software project and spent nearly a week finishing it. Then in the exam, there were only few questions about very basic stuff that you could have gotten from reading 2-3 slides. This would be OK if all students were honest and everyone would have dealt with the subject already so you could skip it in the exam. But because many weren't it was very frustrating for me who actually did spend one week on it and then in the exam there was no reward for having done everything myself. This decreased my motivation to do things properly next time. All the work felt wasted. If you work hard, you want to get some kind of appreciation grade wise.
So make as much of the final exam about subjects covered in homework. Then people will feel the need to actually study it and "the good" students will feel like it was worth investing this much time.
1.1. This is also solves the same problem for group projects
The majority of many group assignments are done by a minority, i.e. the one most motivated student. It was my experience that a lot of my group work ended with me doing most of the work but the others still got the same grade.
If the homework is very relevant to the exam, they will be penalized then. And again the one who put in all the work will feel rewarded.
2. Be specific in the requirements but vague in the implementation
As @WGroleau already wrote, make the task description specific in the requirements but very open in the implementation. This will lead to more individual solutions and plagiarism will be easier to detect.
3. Let students present their solution individually for 5-10 minutes.
If someone submits a solution but can not explain a simple loop or why certain methods are called or what they are doing, you will be able to filter out cheaters quickly.
Caveat from personal experience: Sometimes the presentation was a week or two after the submission so when it came to presenting it, I had forgotten some things, and was struggling to explain basic things in the first few minutes. This was because I did not prepare for the presentation thinking I could do it on-the-fly. A hint to students to prepare might alleviate this.