In this case, the safest choice with respect to the QT interval depends somewhat on what is meant by pencillin allergy. If the allergy is non-anaphylactic, then a cephalosporin would be a reasonable choice, as there’s good evidence that there’s no higher risk of adverse reactions to cephalosporins in patients with a history of non-anaphylactic reactions to penicillins than in the general population. If the patient had a history of an anaphylactic reaction to penicillin, then an alternate agent may be needed. Macrolides and ciprofloxacin are associated with a prolongation of the QT interval. Among the macrolides, there’s no evidence that azithromycin is associated with torsade de pointes and it appears to produce a minimal prolongation of the QT interval.
In this case, of the macrolides azithromycin would be the safest agent with respect to QT interval prolongation. It should be noted that recent recommendations of the Substance Abuse and Mental Health Administration in the United States are that patients on long-term methadone therapy should have an ECG performed to determine if therapy is associated with a prolongation of the QT interval, which also would provide guidance for clinical situations like the one you describe.