I've seen the following claim:
Let $U\subseteq \mathbb{R}^n$ be a bounded, open set with smooth boundary and $u$ a smooth solution of the Dirichlet-problem $$ \begin{cases} \frac{1}{2} \Delta u = 1 \ on \ U \\ u = 0 \ on \ \partial U \end{cases}.$$ For $y \in \mathbb{R}^n$ define the stopping time $ \tau(y) := \inf \{ t \in \mathbb{R} | B_t(y) \in \partial U \} $ where we use the filtration generated by the $n$-dimensional Brownian motion $(B_t)_{t \in \mathbb{R}}$. Then for all $x \in \overline{U}$ $$ u(x) = E^x(\tau). $$
But for example in this question it is claimed, that $E^x(\tau)=\infty$. Is the above claim false?
$\tau$ in this question and in your linked question are different. In the linked question $\tau$ is the hitting time of the boundary of the set $(-\infty,1)$. Here you take $\tau$ to be the hitting time of the boundary of a bounded set (so that in particular, $U \neq (- \infty, 1)$).
With $\tau$ defined as in this question, you have that for $0<p<\infty$, $\sup_{x \in U} E_x[\tau^p] < \infty$. To prove this, first note that $$P_x(\tau < 1) \geq P_x(|B_1 - x| > \operatorname{diam}(U)) =: p_0 > 0$$ Now let $q = 1- p_0 < 1$ so that $\sup_{x \in U}P_x(\tau \geq 1) \leq q$.
Then by the strong Markov property we have that $$P(\tau \geq k) \leq (2\pi)^{-n/2} \int_U \exp(-\frac{|x-y|^2}{2}) P_y(\tau \geq k-1) dy$$ so that inductively we get that $P(\tau \geq k) \leq q^k$. Finally, to conclude, note that $$E_x[\tau^p] = \int_0^\infty P_x[\tau^p \geq t] dt = \int_0^\infty ps^{p-1} P_x[\tau \geq s] ds \leq 1 + \sum_{k=1}^\infty p (k+1)^{p-1}q^k < \infty$$ and take the $\sup$ over $x \in U$.