The Power Of Horcruxes
Ron: "The bit of soul in that diary was possessing Ginny, wasn’t it? How does that work, then?
"Hermione: "While the magical container is still intact, the bit of soul inside it can flit in and out of someone if they get too close to the object. I don’t mean holding it for too long…I mean close emotionally. Ginny poured her heart out into that diary, she made herself incredibly vulnerable. You’re in trouble if you get too fond of or dependent on the Horcrux."
— Hermione on a Horcrux's ability to possess and eventually control a person
POWERS OF HORCURX:
The fragments of a person's soul within a Horcrux can think for themselves and have certain magical abilities, including the ability to influence those in their vicinity. When Harry, Ron, and Hermione were carrying Salazar Slytherin's Locket around their necks in 1997, they each became moodier and more prone to fighting, especially Ron. They were also unable to summon their Patronuses while wearing the locket since the soul fragment inside was darkening their thoughts. A person with an affinity for the Dark Arts, on the other hand, would be strengthened by the influence of a Horcrux, as Dolores Umbridge was when wearing Salazar Slytherin's Locket. If a person is more emotionally vulnerable, it is possible for the soul inside the Horcrux to take control of him or her, as Tom Riddle's Diary did to Ginny Weasley. In fact, Voldemort took advantage of this possessive power to reopen the Chamber of Secrets, using the diary as a weapon rather than a safeguard.
In this way, a Horcrux can gradually feed on another person's life or negative emotions to strengthen itself and increase the ability of the soul fragment within to act independently in the physical world. The best example of this is in the case of Tom Riddle's diary. For decades, the diary lay dormant in Lucius Malfoy's possession, doing nothing other than safeguarding the soul fragment of Tom Riddle. When Ginny Weasley began to transcribe her fears and insecurities into the pages of the diary, the fragment of Tom Riddle's soul contained within was not only able to write back to Ginny but eventually drained enough life out of her to actually manifest itself in a semi-corporeal form and work magic with Harry Potter's wand. Likewise, Salazar Slytherin's Locket slowly gained power when it was in the possession of Harry, Ron, and Hermione in the months prior to its destruction. It can be theorized that the locket gained somewhat less power from them (not enough for Riddle to fully manifest but still enough to speak and create illusions) because Harry, Ron, and Hermione were actively resisting the locket's influence instead of embracing it as Ginny had done with the diary. On the other hand, Horcruxes which have been isolated for long periods of time (such as Hufflepuff's Cup and Ravenclaw's Diadem) were very passive by comparison and took no real measures to protect themselves. Even Slytherin's Locket was fairly inert when it was initially discovered in a cabinet in the drawing room at 12 Grimmauld Place, displaying no powers other than being impossible to open.
Horcruxes also possess some last line of defence against destruction. The fragment of soul within the Horcrux seems to be able to sense impending threats and can act to defend itself. For instance, Slytherin's locket viciously taunted Ron Weasley with visions of his deepest fears in the hopes of preventing him from stabbing it with the Sword of Gryffindor, and even attempted to strangle Harry Potter when he was close to obtaining the Sword with the intent of piercing the locket. However, this form of defence may not be viable if the soul fragment in question is not given enough strength or chance to retaliate, as while Harry opened the locket with Parseltongue before allowing Ron to attack it, both Hufflepuff's Cup and Ravenclaw's Diadem were swiftly destroyed the moment the trio were given an opportunity.
Aside from its self-defence mechanism from the soul fragment, a Horcrux is usually enchanted by the creator to have other forms of defences to prevent destruction. Marvolo Gaunt's ring contained a deadly curse that would kill anyone who touched it. At least Salazar Slytherin's Locket was unbreakable by even house-elf magic. Tom Riddle's diary was completely waterproof and impervious to spilled ink.