A pillowcase is the everyday cover for a sleeping pillow. A pillow sham is a decorative pillow cover, often chosen to coordinate with a comforter or quilt. Both cover a pillow, but they can differ in size, opening and finish. You do not need shams to make a usable bed.
If you have unpacked a bedding set and wondered why there are two pairs of pillow covers, start with the item names rather than the photograph. The two pairs may serve different jobs. The Yellow Daisy Queen set below is a useful example because its contents list names pillowcases and shams separately.

How to tell the covers apart
Pillowcases are intended for regular sleeping use. Shams put more emphasis on the appearance of the made bed. Tuft & Needle describes the usual distinction as a short-side opening on a pillowcase and a back opening on a sham. That is a helpful clue, not a specification for every brand or design.
Check the actual item before assigning a job to it. Look at the opening, any decorative edging and the feel of the surface you would rest on. A shared floral print does not make two covers the same size. In the Yellow Daisy Queen package, the listed pillowcases are four inches longer than the listed shams.

Why one set includes both
The Yellow Daisy Dreamscape Comforter Set in Queen lists one 88 × 88-inch comforter, one 90 × 102-inch flat sheet, one 60 × 80-inch fitted sheet with a 14-inch pocket, two 20 × 30-inch pillowcases and two 20 × 26-inch shams. Those quantities add up to seven fabric pieces.
The four pillow covers do not mean four filled pillows are supplied. Pillow inserts are not named in this package list. If you want to display all four covers at once, you will need suitable pillows for them. You can also use only the covers that suit your routine and keep the others stored.

For the broader package question, see Do Comforter Sets Include Sheets. That guide explains how to count the bedding pieces. Here, the important detail is that pillowcases and shams remain separate entries even when their prints match.
Match each cover to its pillow
Measure the pillows you plan to keep, then compare their dimensions with each listed cover. Do not use the bed size as a shortcut: the word Queen describes the bedding-set option, while the pillowcase and sham have their own measurements. Allow for the pillow's fullness and the cover's closure when checking the actual fit.
Changing the set size can change both covers. The Yellow Daisy King listing specifies 20 × 40-inch pillowcases and 20 × 36-inch shams. Do not carry the Queen measurements over to King. If you already use longer pillows, our King Pillow and Queen Pillowcase Guide walks through a separate fit comparison.
Make the arrangement work for you
For a simple layered arrangement, place the sleeping pillows in their pillowcases and stand the sham-covered display pillows in front. At bedtime, move the display pillows to a clean chair, bench or shelf. This is a styling option, not a rule: keeping just your sleeping pillows on the bed is perfectly workable.
If you prefer sleeping on a sham, examine its fabric, seams, trim and closure first, and follow its care label. Decorative details may be less comfortable against your face. A plain, washable pillowcase is the straightforward choice when you want an easy nightly routine; matching the print is optional.
Check care before mixing the laundry
The Yellow Daisy listing says to machine wash separately in cold water on a gentle cycle, avoid bleach and tumble dry on low. Follow the attached labels for the pieces you receive. Do not assume that another sham with a similar color has the same care instructions, or that decorative covers can join any wash load.
Before buying, confirm three things: the number of pillowcases and shams in your selected option, the dimensions of each, and whether pillow inserts are included. Then choose how many pillows you actually want to use. That keeps a coordinated bedding set from becoming an unexpected shopping list.