Both cities are a train ride from the terminals, with limited service late at night.
Dallas
The DART Orange Line starts at DFW Airport Terminal A station and runs through Las Colinas to downtown Dallas. DART's site lists weekday arrivals from about 3:50am to 1:20am. We have not checked the trip time, so look it up before you plan around it.
Fort Worth
TEXRail runs from the DFW Airport Terminal B station to Fort Worth. The only hours we found were from its 2019 launch, so confirm them with Trinity Metro.
Late at night
If you land after the last train, take a hotel shuttle or a rideshare. The shuttle hotels and the Hyatts are closer than either city.