What contradiction are we looking for when using proof by contradiction?

If we want to prove a statement, “if $p$, then $q$“, by using the technique of proof by contradiction, we would suppose that “$p$ and ~$q$ are true” then we derive a contradiction.
Assume that ~$q$ implies $w$ is true. If we can argue that $w$ is not true by analyzing $p$, can we say that we have proved the “if, then” statement by contradiction?