I have been having a sharp pain just below my ribcage just after running for 2-5 minutes and sometimes after I walk for a long time.

Probable spasm. Probable a muscle spasm involving diaphragm and attachment to ribs. Start slow with activity and stretch and over training period things should settle.