If I understand your question, the answer to your easier problem is yes. (I'm assuming that by the free associative ring over $X$ you mean to take coefficients of words over the integers.)

First, you can order words in the alphabet, initially by degree, and then by ordering elements in $X$ and using a lexicographical ordering on words of equal degree.

Case 1: $u=v$. Then if $p=q$ you can let $x,y$ be arbitrary. If $p\neq q$ then either $x=0$ or $y=0$.

Case 2: $u\neq v$. Clearly $p\neq q$. Without loss of generality, we may assume that $u$ is of larger order than $v$, and also that $p$ is of larger order than $q$ (replacing $x$ by $-x$ if necessary).

Let $x'$ be the term from $x$ with largest order, and let $x''$ be the term (with non-zero support) with smallest order (these might agree), and similarly define $y',y''$. We must then have $x'py'=u$ and $x''qy''=v$. There are thus only finitely many choices for $x',x'',y',y''$.

But then there are only finitely many choices for terms between $x'$ and $x''$ if we limit ourselves to words in elements of $X$ appearing in $u,v,p,q$. If $x$ involved a term with an element of the alphabet $X$ not appearing in those four words, a simple argument tells us that $x(p-q)y$ would have a term that cannot cancel involving that variable, hence could not equal $u-v$. Thus, there are only finitely terms to try (and letting the coefficients be arbitrary constants, you get a system of linear equations).