Running for longer distances

Emma
I know this isn't period related but it is related to general fitness. So I'm trying to run for longer distances and the most I can do right now is a 5k but my knees always hurt either while I'm running or afterwards. I've also had shin splints twice. Are there any runners out there with tips so that I can run longer without as much pain?
Thanks so much!!