Terraria like procedural generation

I want to make a Terraria like game but I’m not sure how to make 2D procedurally generated world, I’m pretty sure I’d need to use noise but I don’t know how to use noise. I don’t want to do biomes or structures yet, I need help with getting the basic generation going that has different layers; Ground, Underground, Core

If your world works on a gird space like your example than defining a matrix for your world space would probably suffice.

Define a background layer.
Define a tile set (0 for none, 1 for ground, 2 for water, … etc.).
Define a matrix the size of your world 1000x1000 or something.
Randomise the matrix so that each cell of the matrix takes a value between 0-2 or higher depending on your tile set.
This is a just a random world, for a more defined world, you must define rules of what values it can take. Like must have at least 2 adjacent neighbour be the same value so that you don’t get dots of single tiles. Or if your coding is alright, try cellular automatons with random seed to define your matrix.