Answer by taking a quote from the following article:

The Drew Carey Show is an American sitcom that aired on ABC from 1995 to 2004, and was set in Cleveland, Ohio, and revolved around the retail office and home life of "everyman" Drew Carey, a fictionalized version of the actor. The show was created by Carey, who had both stand-up comedy and writing experience, and Bruce Helford, who was once a writer for Roseanne. It was the first television show to have an episode simulcast on the Internet. Produced by Mohawk Productions in association with Warner Bros. Television, it debuted on September 13, 1995, and ranked among the Top 30 programs for four seasons before sliding in popularity.

Beginning in season 8, the show rotated through 9 different opening sequences, each of which contained a new version of one of the show's three theme songs. Each theme ("Moon Over Parma", "Five O'Clock World" and "Cleveland Rocks") was seen in three different segments, in new, wildly different arrangements. The show eventually went back to having just five main characters, akin to the first season, as Kate, Mr. Wick, and Steve were eventually written out of the show. Kate's character was married off, Mr. Wick disappeared after three appearances until the Season 8 finale, wherein it is revealed he became a weatherman (although he continued to appear in the opening credits, unlike Kate, who was eliminated completely, and never mentioned again.) Steve left at the beginning of the ninth season to "find himself".  With Winfred-Louder closed, the location became the office of online retailer Neverending Store. Drew, Mimi, and Mr. Wick were hired as employees of the new company. Mimi was hired first in a similar role to her old job, and Drew was eventually hired as "Internal Expediting Analyst", and a recurring gag began wherein Drew had no clue as to what his job entailed. Before being written out, Mr. Wick was at first a janitor, and another recurring joke came in the form of Mr. Wick attempting to climb the ladder back to being the boss. Before being written out, he went from janitor to the carrier of the dessert trolley.  Kate left after the first two episodes of season 8, the same two episodes that introduced Kellie, an old high school friend of Drew's who had been working as a stripper. She eventually became a waitress at The Warsaw Tavern, Drew's girlfriend, and the carrier of his child. The plot of the final episode was Drew and Kellie attempting to get married before their child is born. Mr. Wick also returned and stayed on for the series finale.  The show began featuring cameos from reality-TV participants in the final two seasons, such as former Road Rules star Timmy Beggy, The Real World alumna Cara Khan, and The Amazing Race winner Reichen Lehmkuhl. Tony the Bus Driver (Bill Cobbs) became a regular, serving as smart-alecky "bartender" type to whom Drew could tell his problems. The eighth season was put in a timeslot that frequently clashed with Monday Night Football. It was pulled mid-season and the remaining episodes were shown during the summer of 2003. The ninth season did not air until the summer of 2004, with most of the episodes out of order.  The last season's tone changed radically from the previous seasons. The directors began experimenting with one-camera set-ups, showing the sets completely built, with four walls in most rooms, and with rooms actually linked together. The writers also began experimenting, including story lines in which Gus burns down Mimi's house, forcing her to move in with Drew after Steve leaves her.

Was there anything that affected the ratings for season 8 or 9?
The eighth season was put in a timeslot that frequently clashed with Monday Night Football.