Let $A$ be an integral domain such that $A$ has an infinite number of prime ideals. Then can we say $\bigcap_{\mathfrak{p} \neq (0)} \mathfrak{p}=(0)$? (Here $\mathfrak{p}$ runs over all prime ideals of $A$ excepting $(0)$).
We can say this if $A$ is a principal ideal domain as follows.
If $f\in \bigcap_{\mathfrak{p}\neq (0)}\mathfrak{p}$ is not $0$, then we can write $$f=p_1\cdots p_n$$ as product of irreducible elements. Now since there are infinitely many primes and $A$ is a PID, we can take a prime element $q\in A$ s.t. the prime ideal $(q)$ is not $(p_1),\dotsm, (p_n)$. So $f \notin (q)$ and this is a contradiction.
But I don't know how we can generalize for integral domains $A$ s.t. $A$ is a UFD, or $\dim A=1$ (Krull dimension).
Please show me a proof or a counterexample.
An integral domain $A$ satisfying the condition $\bigcap_{\mathfrak{p} \neq (0)} \mathfrak{p}\ne(0)$ is called a $G$-domain (or a Goldman domain). So you are actually looking for an integral domain with infinitely many prime ideals which is a $G$-domain. If $A$ is noetherian, then there is no such example since noetherian $G$-domains have only finitely many prime ideals. Mindlack provided a (necessarily) non-noetherian example. Another example is the following: let $R$ be the ring of all algebraic integers, $p\in\mathbb Z$ a prime number and $(P_i)$ all the prime ideals of $R$ lying over $p$. (Note that there are infinitely many prime ideals in $R$ lying over $p$.) Then the ring $A=S^{-1}R$, where $S=R\setminus\bigcup P_i$ is not a $G$-domain since $\bigcap_{\mathfrak{p} \neq (0)} \mathfrak{p}=(p)$. Moreover, $\dim A=1$.
The question about UFDs has a negative answer: if a UFD has infinitely many prime ideals, then it is not a $G$-domain, that is, $\bigcap_{\mathfrak{p} \neq (0)} \mathfrak{p}=(0)$. If a UFD has finitely many irreducibles, then it has finitely many prime ideals; see here. Since you assumed that $\mathrm{Spec}(A)$ is not finite it follows that $A$ has infinitely many non-associated irreducibles, and the proof goes as for PIDs.