You don't have to buy fresh and new, and let's be real. If you were using a PC laptop from 2013/2015 seven years later, you would be in a serious world of hurt.
Make note of the software that you use.
Lookup the instructions for doing a full system installation over the internet, follow that procedure.
But before you do that ... go into disk recovery and wipe the partitions and nuke it all.
Then create a new partition "and" don't use APFS. More then likely you don't have the I/O in these boxes to support the extent based filesystem nor the encryption.
Install fresh OS copy.
Then install the first must use application, and test the system for a day. Repeat until your list is complete, and if you make it through congratulations!
Then ... take a time machine backup.
boot off the internet again on 2nd machine, follow the procedure, and when done ... do a time machine restore.
If that doesn't work, it is time to upgrade. The 7 - 9 year old mac's are way past their prime. There are known issue with spectre which tanks the performance of the macs. If you can't afford new and fresh, look at websites like swappa and find a refurb in your budget range.
Also ... the M1 chips change "everything" ... they are wicked fast, so much so I am running win11 arm, rhel9 arm, and my normal workload and the box doesn't sweat (mind you it is a beefy box) .... In fact it outruns a 5900x, 3090, 128GB, 4TB m.2 win11 box I have ... no kidding