There is a purpose, but it is almost exclusively aesthetical.
Just like the material and colour of a frame, the width of the frame and that of the passepartout (or mat) have a huge visual impact on the way an artwork is perceived.
A mild example:
Artist: Lynne Roebuck. Source: adapted from Pinterest
Where proper framing can accentuate an artwork's composition and colour scheme, improper framing can make the same artwork look drab. Professional framing is an art of nuance.
Now the depth of a frame, while not having as much visual impact under most circumstances, depends mostly (and practically) on the type of artwork: a photograph doesn't need a lot of frame depth, whereas a painting, being deeper by nature, preferably needs additional space on the front side as well as the backside for conservational reasons (protection from dust and to facilitate acclimatization, respectively).
Objects that have an even more significant third dimension, like tapestries or sculptures, need more volume.
Some other, practical, considerations for the thickness of a frame are material costs (a beech frame is cheaper than one of rosewood) and structural strength (larger and heavier artworks demand a stronger structure).
When it comes to passepartouts, their function is more to obscure distracting aspects of an artwork, like hiding the edges of the canvas or paper, or to isolate a subject or a more well-balanced composition.
Getting the right colour, width, format, aspect ratio, thickness, grain, &c., is naturally again a matter of aesthetics.
To compare different options, you have ...well, different options:
- In smaller local shops you can usually ask for a comparison between various alternatives, especially if they specialize in framing.
- If you're slightly experienced with any image editor, you can even get a (crude) comparison by trying out things digitally.
- Or physically cut out rectangular shapes in differently coloured paper and of different sizes and widths and determine what works best by shuffling those around.