Which directory should I use

Since using HACS I am a bit confused.
Some custom parts are located in the folder custom-components but others installed using HACS are in www/community.
What is the correct folder? Or should it be in both?
How do I know which should b e where?
Thank you guys for a bit of explaining.