It seems that the arguments are only seen by the initial part of the environment. One way around this is to set a dummy variable in the top of the environment and then use it when you close the environment.
\documentclass{article}
\newenvironment{versionA}[1]
{#1} {}
\newenvironment{versionB}[1]
{\def\versionBOne{#1}} {\versionBOne}
\begin{document}
\begin{versionA}{5}
Hello world!
\end{versionA}
\begin{versionB}{5}
Good Bye, cruel world!
\end{versionB}
\end{document}
Of course, this won't work with nesting, but if you are going to nest these environments then you could set a counter and make the dummy variable name depend on the counter. Environments like enumerate
etc use a similar trick.