Both victims were identified by police on Monday, and investigators said the men were friends.
Alex Cherry, 21, of the 8000 block of Temple Road, was talking to an aide for candidate Chris Rabb around 3:30 p.m. Sunday when someone walked up and shot him in the head.
Rabb "was talking to a voter, a nice young man who works the polls on election day," said Rabb campaign spokesman Chris Visco. "They were talking about the election. The young man was interested in Chris' campaign and his candidacy for the 200th."
Rabb had stepped away before the shooting, his campaign says.
According to investigators, the gunman began to walk away after shooting Cherry but returned and shot him two more times.
"Somebody walked up and deliberately shot someone with every intent of killing them," said Philadelphia Police Commissioner Richard Ross.
"One of the people that was with (Chris) handed him a piece of literature, took his phone number, and another young man came up behind him and shot him execution-style in the head," Visco continued.
Rabb was not hurt.
Four hours later and one block away, on the 8000 block of Temple Road, 18-year-old Elijah Frazier, who was from the 7800 block of Michener Avenue, was shot and killed.
Witnesses tell police an occupant of a red SUV got out of the vehicle and started shooting into a crowd. Frazier was hit in the back and ran to a Chinese takeout restaurant in the 1400 block of Vernon Road.
Officers found Frazier inside that restaurant and rushed him to the hospital, but he was pronounced dead.
A 17-year-old boy suffered a graze wound to the head during this shooting. He is hospitalized in stable condition.