From 2003 to 2013 the district included suburbs of Pittsburgh as well as Beaver County, Lawrence County, and Mercer County. The district had a slight Democratic registration edge, although it had voted for Republicans in several federal elections over the 2000s decade, including for President George W. Bush in 2000 and 2004, as well as Lynn Swann for governor in 2006. The heart of the district was a string of mostly white and middle class suburbs. Plum and Murrysville, two large and mainly residential boroughs, are the main towns in the suburban portion of the district that lies to the east of the city. Also included were the many suburban areas that make up northern Allegheny County and southern Butler County, Pennsylvania, including the larger communities of McCandless and Franklin Park, as well as several exclusive suburbs that have long been home to Pittsburgh's old money elite, including Fox Chapel and Sewickley. The northern suburbs had a generally moderate voting populace, which trends Democratic but makes up the swing vote, especially in races for national office. Further north, the district took on a different character. The suburban areas of Beaver County are somewhat less affluent and were heavily labor Democratic. The areas of Lawrence County and Mercer County had a more rural feel, but also had a union Democrat center within the city of New Castle.
This district changed drastically when Pennsylvania's new districts went into effect on January 3, 2013. Due to slower population growth than the nation as a whole, Pennsylvania lost a seat in Congress in reapportionment following the 2010 United States Census, and this seat was effectively eliminated. Most of the 4th district was merged into a redrawn 12th district, and the previous 19th district was rebranded as the 4th. Thus from 2013 to 2018, the 4th district was located in south-central Pennsylvania and included all of Adams and York counties, as well as parts of Cumberland and Dauphin counties. During this time, the district was represented by Republican Scott Perry.
The Supreme Court of Pennsylvania redrew the state's congressional districts in February 2018 after ruling the previous map unconstitutional due to gerrymandering. The fourth district was reconfigured as a Democratic-leaning area to the northwest of Philadelphia for the 2018 election and representation thereafter. Geographically, it is the successor to the old 13th district, which was represented at the time by Democrat Brendan Boyle. Boyle, however, opted to run in the neighboring 2nd district, the geographic successor to the 1st district, represented by retiring incumbent Bob Brady. The bulk of Perry's representation, including York and Harrisburg, became part of a redrawn tenth district. Gettysburg and Adams County joined a new, heavily Republican 13th District, which was the successor to the old ninth district of retiring Congressman Bill Shuster. Areas to the south and east of York joined Lancaster in a redrawn, heavily Republican eleventh district, the successor of Republican Lloyd Smucker's 16th district.