That hose is the vent from the transfer case, and it is held to the shift lever up under the shift boot. But I don't know what the other thing is.
And the sloppy issue is probably due to the plastic fingers inside the transfer case being worn out. If that is the case then there's no way to fix it w/o rebuilding the transfer case.
Gary, AKA "Gary fellow":
Profile
Dad's: '81 F150 Ranger XLT 4x4: Down for restomod: Full-roller "stroked 351M" w/Trick Flow heads & intake, EEC-V SEFI/E4OD/3.50 gears w/Kevlar clutches
Blue: 2015 F150 Platinum 4x4 SuperCrew wearing Blue Jeans & sporting a 3.5L EB & Max Tow
Big Blue: 1985 F250HD 4x4: 460/ZF5/3.55's, D60 w/Ox locker & 10.25 Sterling/Trutrac, Blue Top & Borgeson, & EEC-V MAF/SEFI