If $X$ is a smooth manifold (and this is the only case when you can speak of a diffeomorphism between $X\times \mathbb R$ and $\mathbb S^n\times\mathbb R$) then this is true by Poincare. If $X$ is not assumed to be a manifold then this is false. For example, there is a theorem of Edwards that if $Y$ is an a closed $(n-1)$-dimensional manifold and a homology sphere then $X$ equal to suspension of $Y$ satisfies that $X\times \mathbb R$ is homeomorphic to $\mathbb S^n\times\mathbb R$. There are many examples of homology spheres already in dimension $3$ which are not spheres so any of them will work.
If $X$ is a smooth manifold (and this is the only case when you can speak of a diffeomorphism between $X\times \mathbb R$ and $\mathbb S^n\times\mathbb R$) then this is true by Poincare. If $X$ is not assumed to be a manifold then this is false. For example, there is a theorem of Edwards that if $Y$ is an $(n-1)$-dimensional manifold and a homology sphere then $X$ equal to suspension of $Y$ satisfies that $X\times \mathbb R$ is homeomorphic to $\mathbb S^n\times\mathbb R$. There are many examples of homology spheres already in dimension $3$ which are not spheres so any of them will work.