On a technical level socialism is a step on the path to communism.
Basically Marx theorized that states go through defined economic (and by extension sociological) phases.
First, there is the hunter-gatherer society. Marx considered these societies pretty much communist.
Second comes feudalism. Where societal exclusion begins. Basically one particular hunter-gather realizes he’s smarter than the rest and crowns himself nobility and creates property.
Next, there is the dictatorship of the bourgeois. Which creates capitalism.
Then once the workers are oppressed enough by their capitalist overlords comes the revolution.
Following this socialism as applied by the dictatorship of the proletariat, which crushes all of the former ruling class and creates the conditions for communism.
Finally, there is world communism. Which is where the dictatorship of the proletariat dissolves itself and society simply functions in a communist mindset. “From each according to his ability, to each according to his need.”
What made Marx and Engels stand out from other socialist thinkers of their era was that they were anti-utopian. Most socialist thinkers believed that the path to socialism and latter communism could be done bloodlessly and through democratic processes. Everyone could be on the bus basically.
Marx rejected this. He postulated that once the revolution happens you’ve got to kick the former ruling class to the curb. Otherwise you get counter-revolution. They can’t get on the bus. They must be destroyed.
The issue is that Marx didn’t really completely develop the ideology. It’s mostly just theory. The communist himself must fill in the blanks and make it practical for that society. It’s why there’s so many different flavors of it. Marxism-Leninism, Stalinism, Maoism, Castroism, and that’s not even getting into the truly bizarre flavors of it, like Anarcho-Communism (developed and postulated by Bukanin, a rival of Marx who was expressedly opposed to the Marxist interpretation).