On your outbound you will go through passport check before boarding both flights, at MCI and IAD, but you will go through British customs and immigration only on arrival at LHR. LHR is the only point where your baggage is subject to search and your passport stamped.
On your return you will go through passport check at LHR, then American customs and immigration at IAD. US rules are that you always pass through customs / immigration at your first landfall city, even if it's not your final destination. You then recheck your bag at IAD for the onward flight. After that you're in the States, so IAD-MCI is just a separate, regular domestic flight with no passport / baggage check involved.