Combining Compliment and Substitue Goods Given
1) Perfect substitutes: X and Y
2) Compliments: Z and X
is it possible to generate a utility function that relates them?

X and Z must always be consumed together, and you can substitute Y for X.
I will leave the clarity of the question aside. 

1) If what is meant by perfect substitutes/complements do not imply that these products are necessarily relevant for the preferences of an agent, then the answer is positive, with the utility function $U(x,y,z)$ being defined as 
$$
U(x,y,z)=0 \text{ for all } x,y, \text{ and }z.
$$
2) If it is implicitly understood that increasing $x$ and $z$ together would yield a higher utility and one for one transfer between $x$ and $y$ consumption yields the same utility for the agent, then the answer is negative. The reasoning can be seen as follows.
$$
\begin{eqnarray}
\mathbf{U(1,2,0)}&amp;=&amp;U(0,2,0) \text{ by perfect complementarity}\\
&amp;&lt;&amp;U(1,2,1) \text{ since $x$ and $z$ consumption together is good}\\
&amp;=&amp;U(0,3,1) \text{ since $x$ and $y$ are perfect substitutes}\\
&amp;=&amp;U(0,3,0) \text{ due to perfect complementarity between $x$ and $z$}\\
&amp;=&amp;\mathbf{U(1,2,0)} \text{ since $x$ and $y$ are perfect substitutes}\\
\end{eqnarray}
$$
leading to a contradiction. A general proof can be written when the assumptions are relaxed, but I believe this is sufficiently clarifying.