Following World War II, the United States and the Soviet Union became enemies for various reasons (see the reference for specifics and views from both sides of the conflict). This led to the "Cold War," which was a very scary time.
The arms race was part of the Cold War. The US had developed the atomic bomb during World War II and had used it on Japan. The Soviet Union recognized that this was a very dangerous weapon and went to all lengths to develop their own. Soon, the US was developing more powerful weapons and the Soviet Union followed suit. This race led to the Mutual Assured Destruction doctrine (the apt acronym is "MAD"), where it was alleged that peace could be maintained if both sides knew that they and their enemies would both be destroyed.
The space race was also part of this. When the Soviet Union launched a satellite in 1955, the US recognized that this could potentially become a new weapon. This eventually led to the race to the moon, which the US won in 1969.
The arms race was distressing for many Americans. In the early days, the US government hid the fact of radiation effects and launched the famous "duck and cover" campaign where school children were instructed to get under their desks in the event of nuclear war. Later, public fallout shelters were created and the signs for them (see file) became a common sight. People even created bunkers and fallout shelters in their basements or back yards.
The response to the space race was more positive as the US cheered their "team" onto victory. President Kennedy made a speech setting the goal of landing a man on the moon in the next decade and after Kennedy's assassination, President Johnson carried on that commitment. NASA embarked upon this ambitious goal by creating a series of missions that taught them what they needed to know in order to put a human being on the moon. Even though the space race was also about weapons, it was also about meeting a challenge and it was a less fearful experience than the arms race.
The space race was abandoned after awhile and the Soviet Union disintegrated, ending the Cold War. The world switched from battles between giants to the David and Goliath of terrorism, where small groups of people learned how to disrupt the workings of large countries. MAD did not lead to peace, although the International Space Station brings nations together to work on science.