$(p \rightarrow q) \wedge (\neg p \rightarrow q)$
$\equiv(p \rightarrow q) \wedge (\neg p \rightarrow q)$
$\equiv(\neg p \vee q) \wedge (p \vee q)$
$\equiv \neg(\neg (\neg p \vee q) \vee \neg(p \vee q))$
$\equiv \neg((p \vee \neg q) \vee (\neg p \vee \neg q))$
$\equiv \neg((p \vee \neg p) \vee (\neg q \vee \neg q))$
$\equiv \neg(T \vee \neg q)$
$\equiv F \vee q$
$\equiv q$
Yes, the step is valid. I don't know if you are told to solve in a certain way, but there are better ways to solve this problem.
One would be a truth table: since there are only two variables, you can write out the result of the expression for each pair $(p,q)$, namely $(T,T), (T,F), (F,T), (F,F)$ and realize that it is equivalent to $q$. It is also not difficult to use your logic (no pun intended) to see that this expression is equivalent to $q$.