Might be time for a new clutch
Hi Kevaug, so the part you have in the picture is the clutch slave cylinder. I have two theories from working on Dodges with slave cylinders just like that one. These are my theories in no particular order of likelihood....
1) The friction material on the clutch disc is so worn that it has driven the slave cylinder out of tolerance. Think of it like a one sided wheel cylinder, inside the bell housing is a rubber boot/diaphragm and a shaft sticking out through it. If it is extended too far, it will break the seals and leak. When the clutch wears far enough, it can cause unusual behavior from the transmission. I currently have a 95 Dakota 2.5 with the AX-15 5 speed. When that clutch went, I had to float 2nd gear. After replacing the clutch, it was right as rain. In this case, you'd need to replace the clutch anyways, as the disc has undoubtedly been contaminated with brake fluid.
2) The slave cylinder has just taken a crap, it happens, especially if it is older. If it has taken a crap, then again, Id replace at the minimum the clutch disc, because as stated in the first scenario the clutch disc has been contaminated with brake fluid. I have also had this happen to me on a 94 Dodge Dakota with the AX-15 5 Speed.
Now I am assuming your truck has the NV3500. Good trans, holds up very well. As far as the idle, are you getting a check engine light? 2004 is OBD2, and if anything electric like your idle motor is bad, that should be throwing a check engine light. If you have no check engine light, you really should investigate the slave cylinder first. Don't forget to check your brake fluid, I am not sure on that year, but my 15 Dart pulls fluid from the brake master cylinder reservoir for the clutch system, but my dakota's had their own. If you do have a check engine light, run it to an auto parts store like Autozone, O'Reillys, or whatnot that will do the check engine light test for free. Ask them what the P code is, that will tell you a much broader picture than them just saying issue with this part. The P code will help you troubleshoot. Hope this helps!