Metronomes are really useful. They provide a steady beat that you can play along with. They come in mechanical and digital versions, but these days we just use phone apps, and there are a ton of free apps on all device platforms. It’s sometimes helpful to also use headphones so that you can’t ignore the beat.
I often recommend that students practice with the metronome. I feel like a hypocrite when I do this, because, like everyone else, I go to great lengths to avoid using it myself! We all hate playing piano with the metronome. But, its really useful, and when I finally give in and actually use it the piece that I am learning quickly becomes perfect!
Metronomes are traditionally used to practice rhythms, and I do recommend their use for this, although I think its really important to not overdo it. Music should have a natural ebb and flow and too much piano playing with a metronome can make you sound like a robot.
I think the real value of the metronome is that it quickly shows you passages that you can’t really play properly, even though you thought that you could! It shows you all the parts of the piece that you need to work on. And somehow when you learn those sections of the piece of piano music with the metronome slowly, your piece gets finished amazingly quickly, and those parts often end up being the strongest parts of your performance. Always start slower than you think you need, and always check that you can play the piece with a metronome before you perform it. Adding this simple and free tool to your musical toolkit will dramatically help you grow as a pianist.