As someone who has gathered experience and grey hairs, I'm often asked by colleagues and younger individuals for career advice. One of the most common scenarios is "I'm considering switching jobs and going to work for Company B, or a new role C' but they're stuck on the dilemma. Often there are concerns about leaving friends and colleagues behind or leaving an employer in the lurch.
My advice is fairly consistent - consider the next-next job. This is a variant of Stephen Covey's "Begin with the End in Mind". Every job should provide benefits - pay, hours, travel or not, environment but most importantly experience to be gained. Hopefully, you have some idea of where you want to go in your career - the 'next-next' job. Maybe you want to be a manager of people for the first time, or transition into sales from a technical role, or move into independent consulting. Whatever your goal is (think 5 years out - classic interview question trope) the job you are considering moving to next should be a natural intermediate step to the next-next job that you want.
This way, as you gain the experience in the new job, it is naturally preparing you for the job you want after that one. When you apply for the next-next job, it is a clear career arc and story that you can tell others.
If you have all the experience and skills necessary for the new job, and are unlikely to learn anything new, it probably isn't worth the change - you're overqualified. Instead you want a job which will provide you ample room to grow and develop and be challenged (depending on stage of life, etc, etc).
So, the next time you're considering a change, or accepting an offer, consider - does this help me get to the next-next job, or is it a fork in the wrong direction?