I would say that it becomes socialism when the government assumes the responsibility of providing for individual needs, rather than just the general needs of society. For example, the military is clearly a general need that is expected to benefit everyone collectively. The soldiers are not there to provide for my personal protection (unless my personal safety is some how directly tied to national security and interests, as with a diplomat). The court system is intended to apply a universal system of laws, benefiting everyone by ensuring that those laws can be enforced and have meaning.
On the other hand, my medical treatment benefits me personally, as does my education. Some would argue that the availability of a hospital that is open to all benefits everyone, but whatever treatments I receive there benefit only me. In contrast, while the court system may punish a criminal for a crime primarily directed at one individual, in doing so, it promotes a law that all members of that community are expected to follow, and equally importantly, that members of the community may expect others to follow. If a thief goes to jail for stealing from you, I also benefit, because the system that put him in jail will presumably discourage others from stealing from me and punish them if they do. If individuals are allowed to steal from on another without consequence, none of us may be secure with our own property.
There are circumstances, of course, in which society might well be impacted by one individual’s medical problems, such as a contagious disease, in which case governmental action would not be considered socialism.