Difficult is the opposite of easy. It means that something requires lots of effort to do it. Hard can be the opposite of "soft" (such as a hard pillow and a soft pillow) but it can also mean "difficult."
For example, you can say:
The test was difficult. = The test was hard.
It's difficult to understand the teacher. = It's hard to understand the teacher.
The word hard is a little more informal, so it's better to use difficult in more formal writing.
The word hard can also be an adverb to describe doing an action with great effort or energy. We often use it with the verbs work and try:
Dry a few curry leaves in shade for 45 days. Take one teaspoon of this dried curry leaf powder and mix a teaspoon of honey in it. Consume this home medicine for about two to three times in a day to get rid of constipation.