could you plse expalin to me the subtle diference between the two and how to use them without confusion
Community is more local in scope: "We have two football fields in our community."
Society is larger/broader in scope: "There are too many obese people in American society."
You are correct that it is a subtle difference.
Another very subtle difference is that society often suggests more formal association than community.
The Society of Civil Engineers.
This suggests a sanctioned, legal, group of members in a titled association.
The community of civil engineers.
This would describe pretty much all civil engineers around the world.