Orbit solenoid

Need to replace the solenoid but home depot doesn’t have one with a long enough thread. Any help to find one that works?

old one in pictures.

Have you tried replacement Orbit solenoid?

https://www.homedepot.com/p/100013771

Thread length is not as important, the active part is the spring loaded plunger. As such solenoid can adjust to a wide variety of valves, with threads being there just to hold it in place.

It made a difference because I couldn’t get a seal.

Looks like your old solenoid is attached to some sort of adapter, rain bird from the looks of it, can you take a picture of your old valve to confirm?

If you already have a replacement orbit solenoid, you could try unscrewing the adapter from the old solenoid to use with the new. Specifically, this is the part that looks like an adapter:

Hold on to it, and turn the solenoid counter clockwise to separate the two.

Otherwise try the rain bird solenoid:
https://www.homedepot.com/p/100563755