I ruined my short cage 10 speed shimano 105 derailleur, I have the chance to get another and I found a medium cage, will this work by just replacing the derialleurs or will I need to switch other things? Thanks.
Generally you can replace a derailleur with a longer caged one without any problems. The length of the cage determines the "spread" of gears that the drivetrain can support.
So, for example, the short cage might get you a 11-28 cassette where a medium cage might work up to 11-32. Note this is just a "for instance" and the specific sizes depend on several factors.
You will almost certainly need to replace your chain since the medium cage will need more links. But it's hard to replace a derailleur without breaking the chain anyway so plan on that.
First, consider if you actually have destroyed the previous derailleur. In a crash, the derailleur hangar is designed to be the weak link, and it will bend. So, if you can’t shift properly, have you checked the hangar alignment? If you’ve bent the hangar, you will need (edit) a bike store to realign it, or to replace it if it breaks. Your bike store or another dealer for the bike in question can source a replacement hangar from the manufacturer. Alternatively, there are third party manufacturers for replacement hangars (most notably Wheels Manufacturing in the US). In my experience, rear derailleurs probably won’t get damaged beyond usability in a crash.
If you actually need a new RD and not just a hangar, most likely you can just swap the derailleurs without changing anything else. The maximum cog size for the short cage RD is 28t. In contrast, the medium cage RD is rated for 28t and up. In my experience, a medium cage RD will actually shift a 12-25 cassette, although the shifting isn’t ideal. Few if any bikes come with 12-25s, so most likely your cassette is within spec anyway. Typical method of chain sizing is independent of RD cage length, so I don’t think chain length matters that much.
Edit note: Park Tools explicitly states that:
It is often possible to repeatedly re-bend many derailleur hangers. This is because there is very little stress from riding the bike or shifting gears. As a rule of thumb, if a hanger survives a repair by bending, it will survive use. However, there are some hangers that do not repair well. Extremely thick hangers and titanium hangers are difficult and sometimes impossible to repair.
There may be a perception that you can’t safely bend an aluminum hangar, and I seem to have absorbed that perception, but it is likely wrong. I am aware that the OP’s hangar snapped, but I am editing this answer for posterity.