ok so when does your period actually end?

like, after the red red blood is over with, there’s just like this murky brown discharge that keeps coming back for a few days even if i clean myself out from the inside. it ruins my underwear’s sometimes.

so when does it actually end?? and is there any way to make the murky brown discharge go away faster??