Here's how to do it at DFW:
For your outbound trip: clear immigration, get checked bags, clear customs then recheck bags with AA prior to leaving international arrivals area. Bag re-check is on LEFT after customs, exit is on right.
After exiting head to the TERMINAL LINK. This is a bus service with in DFW that connects the terminals, outside of security. Sky Link, the train is inside security. Take TERMINAL LINK to your departure terminal, then clear security there. Only terminal at DFW to have NoS is terminal D.
Terminal Link web site:
http://www.dfwairport.com/terminallink/index.php
For your return trip: you can check in at DFW for the DFW-CUN flight at any AA terminal, clear security, then Sky Link train to terminal D for your CUN boarding. I'd recommend terminal B. AA flights out of B are regionals flown by AE, so security line isn't more than 5-10 people (usually). Plus it is next door to terminal D.