Usually a drive shafts length is measured center of front u-joint to center of rear u-joint. You can fine tune the length by swapping transmission yokes. The TH400 ones come in 4, 5, and 7" lengths. You want it installed with about 1" out of the trans from all the way in. On my 4l80E I had a shaft that was about a 1/2 inch short and with the 4" with 1-1/2 out it only had a couple inches in so I went to a 7 inch so that with 1-1/2" out there was still plenty in the trans. You just want to be sure that it's at least 1 inch out so that it can't bottom out inside the trans. That can damage the tailshaft and housing.
Wait until you have your trans and rear end both permanently mounted before ordering the drive shaft. It may determine not only length, but u-joint size. There are a lot of different u-joints out there.
Why a TH400 in a 98 behind an LS1. The engine computer can control a 4l80E which is just as strong as the TH400 and has overdrive. If you're running any kind of good launching gears you'll want the OD.
My current build is running 3.73's in an 8.5/6 with a 4L80E. The late 2wd HD version are almost exactly the same length as a 4l60E. (Within 1/2" in length). Mounts are a little farther forward, but not that much. Holley has a crossmember if you aren't into making your own.