I have this annoying cough ,what should I take ?

I gt this cough usually a couple times a yr, sometimes its very dry, n sometimes its very wet, nt its almost constant, n it feels like it tears my throat up, sometimes my nose runs, when I’m coughing, n sometimes it dnt. Its annoying n embarrassing, what should I take for it? It usually goes away on its own. And is it bad for my throat to cough like that? Am I really tearing my throat up? Its nt a cold, is it contagious?