Place chiles directly over the flame of a gas-stove burner on high heat or on a grill. Roast peppers, turning with tongs, until blackened all over. (Alternatively, broil peppers on a baking sheet, turning, until skin has charred.)
Transfer peppers to a large bowl, and cover immediately with plastic wrap. Set aside to steam, about 15 minutes. Peel peppers; discard skins. Remove stems, seeds, and ribs; coarsely chop and set aside.
Heat oil in a large saucepan over medium heat. Add onion and cayenne pepper; cook, stirring, until onion is very soft, about 6 minutes. Add flour and cook, stirring, until thickened, 1 to 2 minutes. Add tomatoes and chopped chiles; cook for 1 minute. Slowly add milk or cream and cook, stirring, until thickened, 3 to 4 minutes. Add cheeses and cook, stirring, until melted and well combined.
Remove from heat and season with salt and pepper; serve immediately with chips, over nachos, or stirred into chili.