[verb ます stem] + ようによっては [verb ます stem] + ようでは
Note: The verb stem + よう forms a noun meaning "way of doing ~" (e.g. 考え*よう, やりよう, 言いよう)*
This grammar pattern expresses that the outcome or result changes depending on how something is done. It combines よう (way/manner) with によっては (depending on) or では (if/in the case of) to convey the idea that the method, approach, or manner of doing something can lead to different – often significantly different – outcomes.
This form emphasizes that a particular way of doing something could lead to a certain (often positive or at least possible) outcome. It suggests that among various approaches, some may produce favorable results.
The verb stem + よう creates a noun meaning "the way of doing ~" (e.g., かんがえよう考えよう = the way of thinking, やりよう = the way of doing). This noun is then followed by によっては to mean "depending on."
This form typically carries a negative or critical nuance. It warns that if things continue to be done in a certain (usually undesirable) way, the outcome will be bad. It is used to express concern, disapproval, or a warning.
The pattern is formed with the verb stem (ます-stem) + よう to create "the manner/way of doing":