Evidence degrades, memories fade, witnesses die. Generally the worse the crime, the longer the statute of limitations. Murder in most places has no limit.
Also, if someone hasn't committed a crime in, say, 20 years, there's questionable need to lock them up for three years to deter the behavior. Goal is to optimize the overall system even if some people slip through the cracks.
The state isn't in the business of revenge. It prosecutes crimes on your behalf because private vengeance escalates and frequently lands on the wrong person.