Start by taking the time to think through all the things that are wrong with porn and masturbation so that you can clearly see how bad it is. Then consider the proper function of sex - to unite a man and woman as husband and wife and to allow the creation of new life. Really let those thoughts sink in, because the more you can hate what porn is and recognise how it debases sex and obscures its true purpose and goodness, the more you will be motivated to change and to aim for a positive goal. Consider how porn is exploitative, dishonest, intrusive, degrading; how it corrupts your way of seeing things and enslaves you to addictive habits, and how it strips sex of any meaning.
You mention in one of your other questions that you are at university, which I presume means you have access to various support services. Probably the university has a counseling service where you could get support. Or, because porn is fundamentally a moral issue, you may find it more helpful to talk with one of the university chaplains.