Now this is a good "problem" to have! Difficult to generalise - but of course that won't stop me doing so!!
It is usually good policy to cut back any plant getting a little too big for its place after flowering. To just behind the flowers is sage enough - if in doubt, try a couple of shoots to see if growth breaks from the cut section. For herbaceous/perennial subjects one may even cut quite hard back after flowering without damage to the plant.
For woodier subjects, caution is advised - some plants ( even shrubs and trees) will re-sprout well when cut back while others sulk and refuse so to do. Again, trial cuts on one or two stems is advisable to be sure the plant will accept such treatment. It can often be risky for these woodier plants to cut back beyond "green" growth areas.
Hope this gives you a start, Kitty!