In a short phrase: features and pricing. The Galaxy S line (such as the latest Galaxy S23 series) are Samsung's flagship phones. They feature Samsung's latest and best-quality features for their displays, cameras, processors and more. However they also cost at least £800, and likely more if you're looking at the top-specced Plus or Ultra models.
Galaxy A models aim to balance performance and cost for users with tighter budgets. They'll cost around £450 (in the case of the newest Galaxy A54), and may share some specs with the Galaxy S series. However they lag behind on performance and use less powerful cameras.