Answer:
adjective
Step-by-step explanation:
In this case, long would be an adjective.
Adjectives give more information to what it is describing. A sentence can function without an adjective as you can think of it as embellishment. It enhances your writing but is not necessary.
Let us take out long from the sentence:
My grandmother loved to take walks in the woods with me.
There is less description about the length of the walks, but the sentence grammatically functions.
Long is an adjective
I hope this helps! Please let me know if you have any further questions :)