The influence of the Cold War on space exploration was enormous. The Cold War was a struggle for the the future of the Planet in a sense. There seemed only two possibilities, a world dominated by Communist totalitarian government, with all decisions dictated from the center by the 'Party Elite' and individuals reduced to subservient, unimportant, cogs in the machinery of the State; or a world dominated by Capitalist democracies where individuals had more freedom, could make choices and decisions for themselves and the State was supposedly the servant, not the master, of the people.
At a time when the European Empires were dissolving and dozens of new nations were coming to independence in Asia and Africa in the 1950s and 1960s, the path they would take was crucial both to the USSR and to the USA. Each wanted to show to the emerging nations that ITS way was the better way. Technological achievement was an obvious way to demonstrate the superiority of one system over the other. Therefore both the USSR and the USA were desperate to establish a lead in rocketry and satellite design, essential to the field of space exploration. When the USSR launched the first satellite, Sputnik, in 1957, it was a propaganda coup. It said to the world that Communism worked best. The launch into space of the first human, Yuri Gagarin in 1961 carried the same message. Hence the USA's desperate race to catch up with the Soviets and President Kennedy's determination that the USA should beat the USSR in the race to the Moon. Beyond the Moon itself though, there was competition to be the first to send probes to Venus and Mars too.
The expansion of Communism was considered a threat to the USA's strategic interests, and indeed the interests of the West generally. It put at risk essential resources and communications and had the potential to 'snowball' out of control; an echo of this can be discerned in the Vietnam War and the 'domino theory' advanced as a partial justification.
Space exploration was also influenced by the Cold War for another reason. If either of the Super-Powers gained mastery of Space, it could threaten annihilation of its rival, with little risk of retaliation. In the 1950s and 1960s the number of nuclear weapons on either side grew enormously as each side tried to ensure it had enough to retaliate to any 'first strike' by its enemy. Delivery was by bomber at first, then by ground launched missile. Radar could give advanced warning of such actions. A kind of 'stand off' was achieved. The 'advantages' of satellites in orbit to spy on one's opponents were clear to both sides. Once ICBMs were developed, the possibility of weapons orbiting in space to shoot them down before re-entry over their target was also easy to see, though the technological problems remain awesome.
So the Cold War had a major impact on space exploration, both in the struggle for strategic military advantage and in the struggle to try to convince third world countries which 'system' was better.